Hi. (First I must say that I am from Denmark, so i hope that you understand my english.)
I hope that someone will help me. I have tried to make a code for my arduino uno.
I want to have 3 LED's to increase light dependent on a signal from at tempeature sensor.
They should do it in different intervals, so that LED1 should increase light when the signal from the temperature sensor is between 165 and 200, and hold full light to everything above 200.
The LED2 should start at 200 and increase up to 225, and hold full light to everuthing above 225.
The LED3 should start at 225 and increase up to 240, and hold full light to everuthing above 240.
I have used PWM to control the LED's, but they all light all the time and when the temperature changes they increase and decrease in an uncontrolled way.
So my qustions are:
1. Why does the LED's light all the time and why do they increase and decrease uncontrolled?
As mentioned above, I would like to keep the LED's fully lighted if the value exceeds the limits in the 'if' statement.
So second question:
2. Can i in some way use 'constrain' to hold the LED's on when the temperature input signal is over the value that the light should increase on? IF not, what can I use?
I have attached the code.
