const int OFF = 11;
const int ACC = 12;
const int START = 13;
const int RFID = 9;
const int BUTTON = 10;
int val_rfid = 0;
int val_button = 0;
int state = 0;
void setup() {
pinMode(OFF, OUTPUT); // RED LED OUTPUT
pinMode(ACC, OUTPUT); // GREEN LED OUTPUT
pinMode(START, OUTPUT); //GREEN LED OUTPUT
pinMode(RFID, INPUT); //BUTTON INPUT (WILL BE REPLACED WITH RFID)
pinMode(BUTTON, INPUT); //BUTTON INPUT
}
void loop() {
val_rfid = digitalRead(RFID); // READ PIN 9
val_button = digitalRead(BUTTON); // READ PIN 10
if ((val_rfid + val_button) == 2){ //checks if both buttons are pressed
digitalWrite(OFF, LOW); //turns red led off
digitalWrite(ACC, HIGH);//turns green led on
delay(5000); //delays 5 seconds so cant start immediatley
}
if (val_button == HIGH){ //checks if button is pressed
digitalWrite(START, HIGH); //turns start on
delay(3000); //waits 3 seconds
digitalWrite(START, LOW); //turns start off
}
}
this is the code i am writing, but im struggling with a few things. one of these is that i want the red LED to be on when all other LEDs are off but i cant seem to do this. and i dont want it to turn on the second LED without turning on the first one. i have the MAKE: getting started with arduino book so if someone could tell where to look in there rather than what code to write so i can learn myself id be very greatfull.