sci-oly-detector-building

[RADIOACTIVE] arduino thermometer for science olympiad
git clone git://git.figbert.com/sci-oly-detector-building.git
Log | Files | Refs | LICENSE

commit a1fce2e322b9d983d5910b745f011a50bc4316e2
parent 11cc046f66e8e1ff7a00e8e4e7e54e7a60d814a4
Author: therealFIGBERT <figbertwelner@gmail.com>
Date:   Thu, 27 Feb 2020 22:12:51 -0800

:sparkles: Add LED output for temperature ranges

Diffstat:
MOperational/Operational.ino | 23+++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/Operational/Operational.ino b/Operational/Operational.ino @@ -6,8 +6,11 @@ hd44780_I2Cexp lcd; #define TEMPERATURENOMINAL 25 #define NUMSAMPLES 2 #define BCOEFFICIENT 4000 -#define SERIESRESISTOR 100000 - +#define SERIESRESISTOR 100000 + +int red_light_pin= 12; +int green_light_pin = 10; +int blue_light_pin = 11; int samples[NUMSAMPLES]; void setup() { @@ -15,6 +18,9 @@ void setup() { lcd.backlight(); Serial.begin(9600); analogReference(EXTERNAL); + pinMode(red_light_pin, OUTPUT); + pinMode(green_light_pin, OUTPUT); + pinMode(blue_light_pin, OUTPUT); } void loop() { @@ -27,6 +33,19 @@ void loop() { lcd.print(String(temp) + "C"); lcd.setCursor(5, 1); lcd.print(String(volts) + "V"); + if (temp < 18.0) { + digitalWrite(blue_light_pin, HIGH); + digitalWrite(green_light_pin, LOW); + digitalWrite(red_light_pin, LOW); + } else if (temp < 25.0) { + digitalWrite(blue_light_pin, LOW); + digitalWrite(green_light_pin, HIGH); + digitalWrite(red_light_pin, LOW); + } else { + digitalWrite(blue_light_pin, LOW); + digitalWrite(green_light_pin, LOW); + digitalWrite(red_light_pin, HIGH); + } delay(1000); lcd.clear(); }