Tuesday, 15 April 2008

TouchShield: up and running in 5 minutes

*Update* Matt and I are working on a new installation tutorial for the Stealth and Slide since it now includes a bunch of new SubProcessing and fast graphics functions. See the updated Up and running on the TouchShield Stealth and Slide in 5 minutes where it walks you through the entire installation.


So you just got your TouchShield in the mail...


At this point, if your like many, your probably asking the very valid question which is,

"How the hell do I use this thing?"

Up and Coding Fast
  1. What is the TouchShield
  2. IDE Setup
  3. Programming
  4. The Code
  5. Results

What is the TouchShield?

As it's name suggests, the TouchShield is a shield (add-on board) designed to be used with an Arduino Diecimila (www.arduino.cc). The TouchShield gives the Arduino an OLED and Touchscreen to help design more advanced applications based around the Arduino electronics development platform.

Hardware Description
The Arduino
The TouchShield

The Touchshield shares pins 0,1 only during programming and uses pins 2,3 only if serial comms between the Arduino and TouchShield are desired. Serials communications are useful when you want to do Input/Output with the Arduino.

IDE Setup
  1. Install Arduino (If you haven't already)
  2. Extract the zipped touch core into arduino-xxxx/hardware/cores
  3. Replace the arduino-xxxx/hardware/boards.txt file with this one
Here is a hard to see video of me installing the core



Programing

Remember before writing code, select the TouchShield board option from the Arduino menu to compile and download to the TouchShield.


The Code

COLOR red = {255,0,0};
COLOR blue = {0,0,255};

void setup()

{

lcd_rectangle(20,20,80,80, red, blue);

}
void loop()

{

}



Hit the compile (play) button on the IDE and watch the output window to make sure everything compiled correctly. Then, press the program button on the side of the TouchShield. Now upload your code by pressing the upload button in the Arduino IDE.

Results
The above image was drawn on the TouchShield from the included code in this post.

Thats it!
Stay tuned for another more advanced tutorial using Serial to send data between the Arduino and TouchShield.

0 comments:

Post a Comment