Hello,
I am attempting to write the code to allow a LED to temporarily be lit based on a number of factors. I just need some help with the coding side as im fairly new to it all.
Here is the scenario.
Loop
If temperature is greater than 30C and Voltage is not present on a monitored circuit then turn LED on for 1 second.
If temperature is less than 25C and voltage is present on a monitored circuit then turn LED on for 1 second.
else do nothing
Delay 10 seconds
Loop
The LED will be attached to pin 12
Thanks in advance
Sean.
Is this homework? If so, I'm sure you've been learning Boolean logic.
Is your hardware working? How about some "basic" software? i.e. Can you test for the presence of the voltage and can you read the temperature? Can you turn the LED on & off?
I assume you know how to turn the LED on for 1 second?
Other than that, you need to understand if-statements and some [u]Boolean logic[/u]. ("and", "or", and "not" logic.)
Start with one condition. i.e. Turn the LED on if the temp is greater than 30. Then add the second condition... And, if the voltage is not present.
Then add the next condition - If the temp is less than 25. Then add the final voltage-present condition.
For troubleshooting & debugging, make use of the serial monitor. i.e. Display the temperature and display if the voltage is present or not.