I've only just started with arduino, and I'm looking for someone to provide me with what I assume will be a basic edit to a program I've written. I don't have much free time to learn how to do it myself. I've already made the circuit diagram here, along with the code and a link to the tinkercad project. I'm willing to pay for it!
Currently;
- when you press the LOWER push-button, the yellow LED immediately turns on
- when you press the UPPER push-button, the red LED immediately turns on
- when you press BOTH the UPPER and LOWER push-buttons simultaneously, the blue LED immediately turns on
- the white LED at the top doesn't do anything for now
Here's the current code;
int buttonPin1 = 2;
int buttonPin2 = 3;
int LEDred = 8;
int LEDblue = 10;
int LEDyellow = 9;
int buttonStatus1 = 0;
int buttonStatus2 = 0;
void setup() {
pinMode(LEDred, OUTPUT);
pinMode(LEDblue, OUTPUT);
pinMode(LEDyellow, OUTPUT);
pinMode(buttonPin1, INPUT);
pinMode(buttonPin2, INPUT);
}
void loop(){
buttonStatus1 = digitalRead(buttonPin1);
buttonStatus2 = digitalRead(buttonPin2);
if (buttonStatus1 == HIGH && buttonStatus2 == HIGH ) {
digitalWrite(LEDblue, HIGH);
}
else { digitalWrite(LEDblue, LOW);
}
if (buttonStatus1 == LOW && buttonStatus2 == HIGH ) {
digitalWrite(LEDyellow, HIGH);
}
else { digitalWrite(LEDyellow, LOW);
}
if (buttonStatus1 == HIGH && buttonStatus2 == LOW ) {
digitalWrite(LEDred, HIGH);
}
else { digitalWrite(LEDred, LOW);
}
}
Here's what I want to happen;
- The yellow LED turns on ONLY when you PRESS and HOLD the LOWER push button for 2 seconds, and turns off once the button is released.
- The red LED turns on ONLY when you PRESS and HOLD the Upper push button for 2 seconds, and turns off once the button is released.
- the blue LED turns on ONLY when you PRESS and HOLD BOTH the UPPER and LOWER push-buttons simultaneously for 2 seconds, and turns off once the buttons are released.
- the top white LED is turned ON always, but every 5 minutes it turns off for 3 seconds and then comes back on. I need this white LED to function completely independently from the previous push-button functions. If that's not possible, then just forget about the white LED and program only the push-button functions.
Here is the tinkercad project that can be edited and tested if need be
Hopefully that's enough information, let me know if you need more details
Thanks a lot