Temperature Input -> RGB Output

Being a CS Major, this week was fairly easy for me – but it’s still fun to tinker with this stuff. I have little experience messing with hardware in general, so wiring things up was a bit of work. Additionally, the RGB wiring on the LED didn’t seem to match the component’s labels (R and B were swapped), and the main guide for the temperature sensor had the GND and 5V pins switched, causing temperature to increase/decrease in the opposite direction.


Circuit function:

Temperature is read in. If it’s below the minimum threshold, the light color is blue. If it’s above the maximum, it’s red. A middle value can be specified. Between low and mid = lerp between blue and green; between mid and high = lerp between green and red.

Circuit connection: 

Thermal Sensor: S in A0, middle in GND, – in 5V.

RGB LED: – in GND, R (actually B) in 10, G in 9, B (actually R) in 11. 

Check out the code at this pastebin: https://pastebin.com/7kEWGTJB