Examples > TFT
This example for the Esplora with an Arduino TFT screen reads the amount of brightness that falls on the onboard light sensor, and graphs it on screen. This is similar to the serial communication Graph example.
Attach the TFT screen to the socked on your Esplora, with the label "SD Card" facing up.
To use the screen you must first include the SPI and TFT libraries. Don't forget to include the Esplora library as well.
Create a variable for holding the position of the x-axis of the graph. You'll increment this each
setup(), initialize the screen and make the background a nice color.
loop(), read the value from the light sensor, and map it to a value that fits in the screen's height.
Set the stroke color to something that will stand out against the nice color you chose for the background, and draw a line from the bottom of the screen based on the value of the sensor
Before closing up
loop(), check to make sure the graph hasn't gone past the edge of the screen. If it has, erase everything, and start back at 0 on the x-axis.
The complete sketch is below :