This is a collaborative project by myself and Kirk Haroutinian. In this project the Arduino Mega is employed to interface with a color LCD TFT touch screen. As seen in the video above, the temperature plot generated is from random data.
Utilizing the display libraries provided by NUELECTRONICS, displaying graphics and text on the LCD screen is relatively simple. After only a few hours of work, color gradients where easily displayed. A function was designed to convert an 8 bit integer into a color that could be processed by the library's pixel drawing function.
The previous color gradient example was easily expanded by modifying the draw loop to ask for the neighboring pixels then intelligently interpolating to find the proper color. Based on a fixed number of data points, in this way the entire screen is drawn. The algorithm that does this intelligent interpolation was taken from wikipedia and is scalable for more data-points or more display pixels. To test the interpolation function, a driver was written to read out both the input data from a generating function as well as the output of the interpolation function.
The driver output looked perfect but the display was not right. The problem was found to be a data type limitation in integer math. When performing the calculation any time any overflow occurred, the color function received unbounded input. A negative number or a number out of range causing a white pixel or red pixel to be produced. This bug was rather spectacular and made for some very cool looking math. The problem was resolved by promoting all of the integers to floats while performing arithmetic operations.
The project was a spectacular success.