Saturday, February 9, 2013

Arduino Esplora with Display Exercise Program

Everyone wants to play with new hardware.  If you have a new Arduino Esplora, grab an Adafruit 1.8" LCD breakout and load up this program.  It allows you to display sensor values and set LED and buzzer values, to see what is happening.
Snap in the display into the right-hand "display header" row of black header.  The software is available on Github at https://github.com/TheKitty/EsploraApps, file EsploraTest.ino

Select which test you would like via the Switch buttons on the right of the Esplora labelled Switch 1, Switch 2, and Switch 3.

Testing all the buttons and sensors, select Switch 1 (the bottom one):
When you press buttons or move the joystick, the appropriate word turns from white to green.  The linear potentiometer (slider) adjusts, curiously from 1023 on the left to 0 on the right (at least on mine, hope it wasn't soldered in backwards).  The microphone sound value is displayed (yell at it), as is the light sensor value (cover it to change).  Temperature is measured in Celsius and Fahrenheit (under the display above the slider, blow hot breath to raise it).  Finally, accelerometer values (X, Y, and Z axis) are displayed (suddenly move the Esplora to see changes).  When you are done, push down on the joystick (do not move it, press it down firmly, it has a switch there also) to return to the menu.

Testing the RGB LED is easy by selecting Switch 2 at the menu:
Red and Green values may be adjusted from 0 to 255 by moving the joystick up, down, left, and right.  Adjust the blue values with the linear potentiometer slider.  To exit, again press down on the joystick.

Finally, to play with the buzzer, select Switch 3 at the main menu:
Move the linear potentiometer slider to adjust the frequency.  If the sound is annoying, move to the left (low) or press Switch 1 to silence.  Again press the Joystick down to get to the menu.

The code is good in displaying how you might use the Arduino Esplora library calls.  You can access some (but not all) of the hardware directly using lower-level functions but I don't do that as this is to demonstrate the official way to use the Esplora (ok, except for the display which is NOT an official display because as of the writing of this article has not been released).

Hopefully this work will give you ideas on your own exploration with Esplora.