Hey guys,
I havent programmed in a long time, and I am trying to remember a few programming skills, but it seems a little harder than what I thought. I need a program that when an input "2 or 3" is rising, or goes high, the LED on the board flashes 3 times or something like that.
Ideally, I am going to be testing to make sure that the input pins are working.
This is what I have, but I am stuck at the moment, I dont know if an "if" statement will make it work
const int led = 13;
const int WheelSpeedPin2 = 2;
const int WheelSpeedPin3 = 3;
void setup() {
pinMode(led, OUTPUT);
pinMode(WheelSpeedPin2, INPUT);
pinMode(WheelSpeedPin3, INPUT);
attachInterrupt(0, change_int_pin2, RISING);
attachInterrupt(1, change_int_pin3, RISING);
Serial.begin(9600);
}
void loop() {
}
void change_int_pin2()
{
digitalWrite(led, HIGH);
delay(5000);
digitalWrite(led, LOW);
}
void change_int_pin3()
{
digitalWrite(led, HIGH);
delay(5000);
digitalWrite(led, LOW);
}
Any help will be greatly appreciated.