After compiling and testing your first ncurses program, let's write a program to control hardware such as LEDs and a buzzer by providing input from the keyboard.
Controlling LEDs and a buzzer using ncurses
Wiring connections
For this particular example, we will need two LEDs and one buzzer. The wiring connections of the LEDs and the buzzer to the RPi are as follows:
We can see the following from the connection diagram:
- The positive (anode) pin of the first LED is connected to the wiringPi pin number 15, while the negative (cathode) pin is connected to the physical pin number 6 (the ground pin).
- The positive pin of the second LED is connected to the wiringPi pin number 4, while the negative pin is connected to the...