...

The first week of physical computing. Lessons on how electricity works. Schematics. Microcontrollers. The basics of Arduino.

  1. Read a momentary switch being pressed.
  2. When the programme starts, both LEDs are off.
  3. When the switch is pressed once, the first LED lights up.
  4. Pressing the switch a second time will turn on the second LED (the first should still be on).
  5. Pressing the switch a third time will turn off both LEDs.

I’m having trouble understanding everything. Doing the assignment was difficult. I also didn’t think about it enough to figure it out. I managed to get the first LED to turn on and off with an if statement. But didn’t get the second one to react to the button. Also, the 1st LED was not reacting properly due to the Arduino reading the state of the button too many times every second. That made the program unstable. I also forgot to put a transistor near the button.

Images

Detail image