This document provides an example code for the Esplora with an Arduino TFT that reads light sensor values and graphs them on the screen. It initializes the TFT display, reads the sensor, and draws a line representing the sensor value. The graph resets when it reaches the edge of the screen, allowing for continuous display of sensor data.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
4 views1 page
Thank 88
This document provides an example code for the Esplora with an Arduino TFT that reads light sensor values and graphs them on the screen. It initializes the TFT display, reads the sensor, and draws a line representing the sensor value. The graph resets when it reaches the edge of the screen, allowing for continuous display of sensor data.
int sensor = Esplora.readLightSensor(); // map the sensor value to the height of the screen int graphHeight = map(sensor, 0, 1023, 0, EsploraTFT.height());
// erase it and start over from the other side if (xPos >= 160) { xPos = 0; EsploraTFT.background(250, 16, 200); } else { // increment the horizontal position: xPos++; }