Control Raspberry GPIO pins

A short recap, I need:

 

- 8 GPIO pins to select presets
- 2 GPIO pins to select bank value
- 1 GPIO pins to control a LED (for example, Raspberry OS and Plug up and running, or Raspberry shutting down).
 


Raspberry pin - 

BCM pin

 

01 - 3v3

02 - 5v

03 - gpio02

04 - 5v

05 - gpio03

06 - gnd

07 - gpio04

08 - gpio14

09 - gnd

10 - gpio15

11 - gpio17

12 - gpio18

13 - gpio27

14 - gnd

15 - gpio22

16 - gpio23

17 - 3v3

18 - gpio24

19 - gpio10

20 - gnd

21 - gpio09

22 - gpio25

23 - gpio11

24 - gpio08

25 - gnd

26 - gpio07

27 - ID_SD

28 - ID_SC

29 - gpio05

30 - gnd

31 - gpio06

32 - gpio12

33 - gpio13

34 - gnd

35 - gpio19

36 - gpio16

37 - gpio26

38 - gpio20

39 - gnd

40 - gpio21

My list of reserved pins:
gpio 18-21 (pin 12, 35, 38, 40) and gpio 2, 3 are used by hifiberry DAC
gpio (4, 5, 6, 16, 17, 26 (pin 3, 5, x, x, x, x, x) are used by audio products
pin 27, 28 are rpi id eeprom reserved
 
I have chosen to use the following free GPIO pins: 
24 - gpio08 - preset 0 x bank_number
21 - gpio09 - preset 1 x bank_number
19 - gpio10 - preset 2 x bank_number
23 - gpio11 - preset 3 x bank_number
32 - gpio12 - preset 4 x bank_number
33 - gpio13 - preset 5 x bank_number
08 - gpio14 - preset 6 x bank_number
15 - gpio22 - preset 7 x bank_number
16 - gpio23 - inc bank_number
18 - gpio24 - dec bank_number
22 - gpio25 - led - "plug connected to amp"

I found many ways to control Raspberry GPIO pins from C++ code, the most popular is wiringPi .

I got the source code from GitHub:
wget https://github.com/milliways2/wPi/archive/refs/heads/master.zip

Then I unzipped the code and cd to the source folder; from source folder I run the following command:
 
./build
 
To verify if wiringPi is working, run the commands:

gpio -v



Commenti

Post popolari in questo blog

Build the footswitch (part 2)

Build the footswitch (part 1)

Add more preset selections to Plug