<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>serial &#8211; About Things | A Hans Scharler Blog</title>
	<atom:link href="https://nothans.com/tag/serial/feed" rel="self" type="application/rss+xml" />
	<link>https://nothans.com</link>
	<description>Life, Comedy, Games, Tech, Marketing, and Community</description>
	<lastBuildDate>Fri, 02 Sep 2022 14:34:27 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://i0.wp.com/nothans.com/wp-content/uploads/2023/02/cropped-settings.png?fit=32%2C32&#038;ssl=1</url>
	<title>serial &#8211; About Things | A Hans Scharler Blog</title>
	<link>https://nothans.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">114568856</site>	<item>
		<title>TouchShield Slide Two-way Communications</title>
		<link>https://nothans.com/touchshield-slide-two-way-communications</link>
					<comments>https://nothans.com/touchshield-slide-two-way-communications#respond</comments>
		
		<dc:creator><![CDATA[Hans Scharler]]></dc:creator>
		<pubDate>Sun, 21 Mar 2010 05:26:00 +0000</pubDate>
				<category><![CDATA[ThingSpeak]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[liquidware]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[serial]]></category>
		<category><![CDATA[TouchShield Slide]]></category>
		<guid isPermaLink="false">http://nothans.com/touchshield-slide-two-way-communications</guid>

					<description><![CDATA[]]></description>
										<content:encoded><![CDATA[<p>Last summer, I got the GamePack from Liquidware which includes a touch screen display, joystick, microcontroller, and battery pack. With this kit, you can make a GameBoy from scratch. With some blood, sweat, and tears, I was able to re-create some games like Asteroids and Tetris.</p>
<p>The touch screen is called the TouchShield Slide which is a 320×240 OLED and resistive touch screen. The screen also has a microcontroller that is Arduino compatible and expands your program space. Since the screen is really a microcontroller in disguise, it can be used for many types of projects. Overall I am very happy with the screen, but I realized I didn’t know how to use it very well. I set out to learn and develop a protocol / reusable library that allows the screen to talk to a microcontroller and vice-versa. So I wanted to take a moment and explain what I learned &#8211; maybe you can get going faster than I did.</p>
<h3>The Goal</h3>
<p>My goal is to be able to display data on the screen that has been received from another device. The data requested would be initiated by a touch on the screen. The protocol has to be consistent and reliable while being flexible enough to be the basis for future projects.</p>
<p>Touch -&gt; TouchShield Slide -&gt; Arduino -&gt; TouchShield Slide</p>
<p><img data-recalc-dims="1" fetchpriority="high" decoding="async" data-attachment-id="1060" data-permalink="https://nothans.com/touchshield-slide-two-way-communications/system-overview-2" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2010/03/System-Overview-1.jpg?fit=546%2C386&amp;ssl=1" data-orig-size="546,386" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="System Overview for TouchSlide" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/nothans.com/wp-content/uploads/2010/03/System-Overview-1.jpg?fit=300%2C212&amp;ssl=1" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2010/03/System-Overview-1.jpg?fit=546%2C386&amp;ssl=1" class="aligncenter size-full wp-image-1060" src="https://i0.wp.com/nothans.com/wp-content/uploads/2010/03/System-Overview-1.jpg?resize=546%2C386" alt="" width="546" height="386" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2010/03/System-Overview-1.jpg?w=546&amp;ssl=1 546w, https://i0.wp.com/nothans.com/wp-content/uploads/2010/03/System-Overview-1.jpg?resize=300%2C212&amp;ssl=1 300w" sizes="(max-width: 546px) 100vw, 546px" /></p>
<h3>Programming Tips and Tricks</h3>
<p>I found quite a few libraries and resources on liquidware.com.  I also discovered quite a few important things through my trial and error. My biggest frustration was with programming and figuring out the IDE. Here are some tips.</p>
<ul>
<li>To program the screen use the Antipasto Arduino / Aardvark IDE</li>
<li>Program the screen and Arduino separately &#8211; make sure the IDE has the proper device selected</li>
<li>To put the screen in program mode, press the switch beside the power connector &#8211; it’s in program mode when the LED on the backside is red</li>
</ul>
<h3>TouchShield Slide Serial</h3>
<p>Serial data sent and received by the TouchShield Slide uses the hardware serial lines.</p>
<p>To setup the serial connection, place this line in your setup code block:</p>
<p>[cc lang=”c”]Serial.begin(9600);[/cc]</p>
<p>Now you can read and write to and from the serial buffer. To read in a whole string, use a byte array to store bytes from the serial buffer when serial data is available. To write to the serial buffer, simply use serial print.</p>
<p>[cc lang=”c”]char charIn = 0;<br />
byte i = 0;<br />
char stringIn[32] = “”;</p>
<p>while(Serial.available()) {<br />
charIn = Serial.read();<br />
stringIn[i] = charIn;<br />
i += 1;<br />
}</p>
<p>Serial.print(“A”);[/cc]</p>
<h3>Arduino Serial</h3>
<p>On the Arduino side, you have to use some form of Software Serial that sends and receives data on Pins 2/3. I have found that the Adafruit SoftSerial Library, “AFSoftSerial.h”, works the best. It seems to be reliable and produces consistent results when talking to the TouchShield Slide. Reading and writing from a software serial buffer is about the same as a hardware one with this library.</p>
<p>To use software serial, follow these steps:</p>
<ul>
<li>Include the “AFSoftSerial.h” library in your Arduino code header space</li>
<li>Define the RX and TX pins</li>
<li>Instantiate the software serial</li>
<li>Initiate the software serial line</li>
</ul>
<p>[cc lang=”c”]#include AFSoftSerial.h</p>
<p>#define RX_PIN 3<br />
#define TX_PIN 2</p>
<p>AFSoftSerial touchSerial = AFSoftSerial(RX_PIN, TX_PIN);</p>
<p>void setup() {<br />
touchSerial.begin(9600);<br />
}[/cc]</p>
<h3>Demo Project</h3>
<p>I took a moment to put together all of the things that I learned into a quick demo project. This project displays a random number on the screen. The random number is generated by an Arduino, sent via serial, and requested by a touch of the TouchShield Slide.</p>
<p>Random Number from Arduino Displayed after Detecting a Touch&#8230;</p>
<p><img data-recalc-dims="1" decoding="async" data-attachment-id="1058" data-permalink="https://nothans.com/touchshield-slide-two-way-communications/touch-2" data-orig-file="https://i0.wp.com/nothans.com/wp-content/uploads/2010/03/Touch-1.jpg?fit=620%2C371&amp;ssl=1" data-orig-size="620,371" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="TouchSlide for Arduino" data-image-description="" data-image-caption="" data-medium-file="https://i0.wp.com/nothans.com/wp-content/uploads/2010/03/Touch-1.jpg?fit=300%2C180&amp;ssl=1" data-large-file="https://i0.wp.com/nothans.com/wp-content/uploads/2010/03/Touch-1.jpg?fit=620%2C371&amp;ssl=1" class="aligncenter size-full wp-image-1058" src="https://i0.wp.com/nothans.com/wp-content/uploads/2010/03/Touch-1.jpg?resize=620%2C371" alt="" width="620" height="371" srcset="https://i0.wp.com/nothans.com/wp-content/uploads/2010/03/Touch-1.jpg?w=620&amp;ssl=1 620w, https://i0.wp.com/nothans.com/wp-content/uploads/2010/03/Touch-1.jpg?resize=300%2C180&amp;ssl=1 300w" sizes="(max-width: 620px) 100vw, 620px" /></p>
<p>Visit Liquidware’s App Store to download the source code and library for this demo project.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nothans.com/touchshield-slide-two-way-communications/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">686</post-id>	</item>
	</channel>
</rss>
