diff --git a/README.md b/README.md index b5dfde1c4d221dff125c45ce6f2d22820afc204a..1bebd53bdc24595ec4bc39fa2f5b0e7ce24d3f50 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ 2. [DCMotor](#2-dcmotor) for running the IBT_2 BTS7960 motordriver - http://www.hessmer.org/blog/wp-content/uploads/2013/12/IBT-2Module.jpg - https://www.ebay.de/sch/i.html?_from=R40&_trksid=p2380057.m570.l1313.TR0.TRC0.H0.XBTS7960+Motordriver.TRS0&_nkw=BTS7960+Motordriver&_sacat=0 -3. [ExternButton](#3-externbutton) for reading the value of a button connecting a GPIO pin with GND +3. [ExternButton](#3-externbutton) for reading the value of a push button or switch connecting a GPIO pin with GND 4. [ServoMotor](#4-servomotor) for running a servomotor ## 1. ADC @@ -14,7 +14,7 @@ ### How to Use 1. Connect outermost pins of the potentiometer to 3V und GND on the board. 2. Connect middle pin of potentiometer to GPIO pin PC1, -3. Add ADC.cpp to your CMake target: ECOS_ADD_EXECUTABLE(app main.c src/ADC.c \<other sources\>) +3. Add ADC.cpp to your CMake target: ECOS_ADD_EXECUTABLE(app main.c src/ADC.cpp \<other sources\>) 4. Include ADC.h where you want to use the ADC. 5. Run adc_init() once before first usage. 6. Every call to adc_get(11) will now return an unsiged integer between 0 and 4096 telling you the current position of the potetiometer. @@ -45,12 +45,22 @@ Connections are as follows: 1. Connect VCC and GND pin of the motordriver to 5V and GND on the board respectifly. 2. Connect R_EN and L_EN to PC4 and PC5. 3. Connect RPWM to PB0 and LPWM to PB1. -3. Add DCMotor.cpp to your CMake target: ECOS_ADD_EXECUTABLE(app main.c src/DCMotor.c \<other sources\>) -4. Include DCMotor.h where you want to control the motor. -5. Run dc_init() once before first usage. -6. Controll the motor by calling dc_set(\<DC_RIGHT|DC_LEFT\>, \<0...255\>) +4. Add DCMotor.cpp to your CMake target: ECOS_ADD_EXECUTABLE(app main.c src/DCMotor.cpp \<other sources\>) +5. Include DCMotor.h where you want to control the motor. +6. Run dc_init() once before first usage. +7. Controll the motor by calling dc_set(\<DC_RIGHT|DC_LEFT\>, \<0...255\>) ## 3. ExternButton +### How to Use +1. Connect on end of the button with GPIO pin PD11. +2. Connect the other end with GND. +3. Add ExternButton.cpp to your CMake target: ECOS_ADD_EXECUTABLE(app main.c src/ExternButton.cpp \<other sources\>) +4. Include ExternButton.h where you want to read the output. +5. Run button_init() once before first usage. +6. Read the state by calling button_get(); + +### Possible edits +A simple button can be used with any unused GPIO pin on the board. All you have to do is to replace or copy the init and the get function and change the port and pin number (the D and the 11 in the sourcecode), which are easy to find out: PE7 -> Port E Pin 7. ## 4. ServoMotor