Skip to content
Snippets Groups Projects
Commit f3d84886 authored by Werner Sembach's avatar Werner Sembach
Browse files

Update README.md

parent a047330b
Branches
Tags
No related merge requests found
# Library for Less Pain programming the STM32F411E-Discovery
# Library for Less Pain Programming the [STM32F411E-Discovery](http://www.st.com/en/evaluation-tools/32f411ediscovery.html) Board
This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this library. If not, see <http://www.gnu.org/licenses/>.
## Contents
1. [ADC](#1-adc) for reading potentiometer values
2. [DCMotor](#2-dcmotor) for running the IBT_2 BTS7960 motordriver ([Image](http://www.hessmer.org/blog/wp-content/uploads/2013/12/IBT-2Module.jpg), [eBay](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 push button or switch connecting a GPIO pin with GND
4. [ServoMotor](#4-servomotor) for running a servomotor
4. [ServoMotor](#4-servomotor) for running four servo motors (calibrated for ES-030)
## 1. ADC
### 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,
2. Connect middle pin of the potentiometer to GPIO pin PC1.
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.
......@@ -48,6 +53,9 @@ Connections are as follows:
6. Run dc_init() once before first usage.
7. Controll the motor by calling dc_set(\<DC_RIGHT|DC_LEFT\>, \<0...255\>)
### Possible edits
You could look up the other two pins connected to TIM3 in the datasheet of the processor ([product page](http://www.st.com/en/microcontrollers/stm32f411ve.html) -> [datasheet](http://www.st.com/content/ccc/resource/technical/document/datasheet/b3/a5/46/3b/b4/e5/4c/85/DM00115249.pdf/files/DM00115249.pdf/jcr:content/translations/en.DM00115249.pdf) -> 4. Pinouts and pin description) and use them for another IBT_2 motor driver by connecting them to RPWM and LPWM and copy and modify the dc_set() function. Be aware hat both R_EN and L_EN must be connected to set(high) GPIO pins. This is done in die dc_init() function.
## 3. ExternButton
### How to Use
1. Connect on end of the button with GPIO pin PD11.
......@@ -61,6 +69,12 @@ Connections are as follows:
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
1. Connect the VCC and GND pins of the servo motors with 5V and GND respectifly.
2. Connect control pins of the servos to GPIO pins PD12-PD15.
3. Add ADC.cpp to your CMake target: ECOS_ADD_EXECUTABLE(app main.c src/ServoMotor.cpp \<other sources\>)
4. Include ServoMotor.h where you want to controll the servo motors.
5. Run servo_init() once before first usage.
6. Every call to set_servo_percent(\<SERVO_0|SERVO_1|SERVO_2|SERVO_3>, \<0.0...1.0\>) or set_servo_degree(\<SERVO_0|SERVO_1|SERVO_2|SERVO_3>, \<0.0...180.0\>) will now move the respective servo to a new position.
# TODO
- add authors in source files
### Possible edits
\#define MIN_UPTIME 150 and \#define MAX_UPTIME 300 can be used to calibrate the servos to a new minimum and maximum position and therefore it should be no problem to also use other servo models with this library.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment