Examples > TFT
This example for the Esplora with an Arduino screen reads the input of the joystick's two axes and the slider, using the values to change the screen's color.
Color on the TFT screen screen is handled as 8-bit numbers (0-255). However, the library scales these values to 5-bits (32 levels) for red and blue, 6-bits (64 levels) for green.
Attach the screen to the socket 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.
setup(), start serial communication so you can read the values used for the background color. Also, start the screen and make the background white.
loop(), read the values fron the joystick axes and slider, mapping them to values between 0-255. with
background(), set the mapped background colors and print the values to the serial monitor.
The complete sketch is below :