Skip to content

C++ code to utilize the GPIOs on the Raspberry Pi

Notifications You must be signed in to change notification settings

Morgenkaff/2semPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

2semPI

This is a simple program for controlling the GPIOs of the Raspberry Pi 3 with C++.

Compile with:

g++ src/*.cc -lpigpio -lrt -lpthread -o grip-control
  • lpigpio is for the pigpio library, used for the GPIOs (http://abyz.me.uk/rpi/pigpio).
  • lrt is required by pigpio. Used for realtime.
  • lpthread is used to seperate a thread for checking inputs independent from the main program.

The code should have sufficient comments to grasp the in and outs.

  _________________________________
 |        PINS ON HARDWARE:        |
  ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
                 _____
            3.3v|-- --|--
       open_grip| 2 --|--
      close_grip| 3 --|GND
         kill_sw| 4 14|green_led
             GND|-- 15|red_led
     bottom_side|17 18|--
        top_side|27 --|--
close_end_switch|22 23|blue_led
            3.3v|-- 24|yellow_led
 open_end_switch|10 --|GND
    open_grip_ur| 9 25|--
   close_grip_ur|11  8|--
             GND|--  7|--
              --|-- --|--
              --| 5 --|GND
          step_3| 6 12|--
              --|13 --|GND
              --|19 16|is_ready
          step_1|26 20|step_4
             GND|-- 21|step_2
                 ¯¯¯¯¯
 
 The names are the same used for the vars used for the pin names in teh code.
 ('--' indicates that pin is not used/connected on hardware.)
 (step_# is used either by the stepper motor OR the dc motor. The dc only uses step_1 and step_2. 
 Better names could be found..)

TODO:

  • There should be a style guide
  • ...

About

C++ code to utilize the GPIOs on the Raspberry Pi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages