//Challenge 1: make the red button work as green button (15 minutes)
//Challenge 2 (30 minutes) - add green LED for green buttton and
//red led for red button- let them glow. Turn green off when hit green button
//turn red off when hit red button
const int interruptPin2 = 2;
volatile bool isButtonPressed2 = false;
const int interruptPin3 = 3;
volatile bool isButtonPressed3 = false;
void setup()
{
Serial.begin(9600);
pinMode(interruptPin2, INPUT_PULLUP);
pinMode(interruptPin3, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin2), button_pressed2, LOW);
attachInterrupt(digitalPinToInterrupt(interruptPin3), button_pressed3, LOW);
Serial.println("Set up is done");
}
void loop()
{
if (isButtonPressed2) {
Serial.println("Button 2 Pressed!");
isButtonPressed2 = false;
}
if (isButtonPressed3) {
Serial.println("Button 3 Pressed!");
isButtonPressed3 = false;
}
}
//ISR for pin 2
void button_pressed2()
{
isButtonPressed2 = true;
}
//ISR for pin 3
void button_pressed3()
{
isButtonPressed3 = true;
}