Well i am trying to create a simple project that with 3 buttons i will controll 3 leds. If button 1 is pressed led one is on , if 2 led 2 and if 3 led 3. If idle after 15 minutes all are off until a button is pressed.
i came up with that reading some tutorials but by default leds are on.
Any suggestions?
i havent addresed the issue with the idle 15 minutes time yet.
const int LM = 12; // the pin for the man led
const int LW = 11; // the pin for the woman led
const int LN = 10; // the pin for the none led
const int bM = 7; // the pin for the man button
const int bW = 8; // the pin for the woman button
const int bN = 9; // the pin for the none button
int valM = 0; //is used to store the values of the man pin
int valW = 0; //is used to store the values of the man pin
int valN = 0; //is used to store the values of the man pin
void setup() {
// put your setup code here, to run once:
{
Serial.begin(9600);
Serial.println("--- Start Serial Monitor SEND_RCVE ---");
Serial.println(" Type in Box above, . ");
Serial.println("(Decimal)(Hex)(Character)");
Serial.println();
}
//--(end setup )---
pinMode(LM, OUTPUT);
pinMode(LW, OUTPUT);
pinMode(LN, OUTPUT);
pinMode(bM, INPUT);
pinMode(bW, INPUT);
pinMode(bN, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
valM = digitalRead(bM);
valW = digitalRead(bW);
valN = digitalRead(bN);
if (valN == HIGH) {
digitalWrite(LN, HIGH);
Serial.print(" LED NONE is ON ");
digitalWrite(LM, LOW);
digitalWrite(LW, LOW);
}
else if (valM == HIGH) {
digitalWrite(LN, LOW);
digitalWrite(LM, HIGH);
Serial.print(" LED MAN is ON ");
digitalWrite(LW, LOW);
}
else if (valW == HIGH) {
digitalWrite(LN, LOW);
digitalWrite(LM, LOW);
digitalWrite(LW, HIGH);
Serial.print(" LED WOMAN is ON ");
}
}