hey, so i got this school project that i'm working on with my friends with so little arduino and code knowledge.
so, there's 5 lights and 3 push buttons
red led = indicates power
white led = indicates "ozone mode"
green led = indicates "uv mode"
yellow led = indicates "auto mode"
orange led = this is the ozone
blue led = this is the uv
button (naming from left to right)
button 1 = stop button
button 2 = auto button
button 3 = ozone/uv button
i'm trying to replicate a sterilizer fridge that our school have
button 3 :
so, the red led turns on forever indicating there are power. if i push the button 3 (ozone/uv) the orange led and the white led lights up for 60 minutes and after that they will turn off. if i push the button 3 again, instead of turning on the white and red, now the green led and the blue led lights up for 60 minutes and turn off after.
( im trying all my best to code this but it doesnt want to turn on the green and blue led after i pushed the button for the second time)
easier example :
button 3 : pushed 1 time
- white led on
- orange led on
delay 60 minutes - white led off
- orange led off
button 3 : pushed 1 more time
- green led on
- blue led on
delay 60 minutes - green led off
- blue led off
button 2(auto button)
if i push the button 2, the yellow led turned on indicating the auto mode. then the orange led turns on for 60 minutes indicating ozone, and then automatically the orange led turns off, without me pressing the button again, now the blue led turns on for another 60 minutes and turns off again after. then after the blue led off, the yellow led also turned off indicating the auto mode is off
easier example :
button 2 : pushed
yellow led on
orange led on
delay 60 minutes
orange led off
blue led on
delay 60 minutes
blue led off
yellow led off
button 1 (stop button)
so if the button 3 or 2 is on, if i push the button 1 or the stop button, all of the button 3 or 2 activity will turned off
and that pretty much it, i hope anyone can help me to code this and also teach me lol, thank you!
I have managed to code only the auto button but have no idea to code the other buttons
int st=1, au=2, ozo=3, ledp=4, ozone=5, ledozo=6, leduv=7, uv=8, ledau=9, o=0, a=0, s=0;
int count = 0;
void setup (){
pinMode (1, INPUT);
pinMode (2, INPUT);
pinMode (3, INPUT);
pinMode (4, OUTPUT);
pinMode (5, OUTPUT);
pinMode (6, OUTPUT);
pinMode (7, OUTPUT);
pinMode (8, OUTPUT);
pinMode (9, OUTPUT);
digitalWrite(4,1);
digitalWrite(5,0);
digitalWrite(6,0);
digitalWrite(7,0);
digitalWrite(8,0);
digitalWrite(9,0);
}
void loop () {
digitalWrite(4,1);
a = digitalRead(2);
s = digitalRead(1);
if (s == HIGH)
delay(100);
digitalWrite(5,0);
digitalWrite(6,0);
digitalWrite(7,0);
digitalWrite(8,0);
digitalWrite(9,0);
if (a == HIGH){
delay(100);
digitalWrite(5,1);
digitalWrite(6,1);
digitalWrite(7,0);
digitalWrite(8,0);
digitalWrite(9,0);
delay(5000);
digitalWrite(5,0);
digitalWrite(6,0);
digitalWrite(7,0);
digitalWrite(8,0);
digitalWrite(9,0);
digitalWrite(5,0);
digitalWrite(6,0);
digitalWrite(7,1);
digitalWrite(8,1);
digitalWrite(9,0);
delay(5000);
digitalWrite(5,0);
digitalWrite(6,0);
digitalWrite(7,0);
digitalWrite(8,0);
digitalWrite(9,0);
}
}