![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
110_robot_H_Bridge8835_UserButton_DIR_PWM
main.cpp@0:f53860730a45, 2022-01-31 (annotated)
- Committer:
- itbusch
- Date:
- Mon Jan 31 16:59:51 2022 +0000
- Revision:
- 0:f53860730a45
- Child:
- 1:2849454dd0ab
110_robot_H_Bridge8835_DIR_PWM
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
itbusch | 0:f53860730a45 | 1 | /* mbed BuschA |
itbusch | 0:f53860730a45 | 2 | */ |
itbusch | 0:f53860730a45 | 3 | |
itbusch | 0:f53860730a45 | 4 | #include "mbed.h" |
itbusch | 0:f53860730a45 | 5 | |
itbusch | 0:f53860730a45 | 6 | DigitalIn CableSwitch(D2); //PullUp auf Board, PA_10 |
itbusch | 0:f53860730a45 | 7 | PwmOut M1_PWM(D9); |
itbusch | 0:f53860730a45 | 8 | DigitalOut M1_DIR(D7); |
itbusch | 0:f53860730a45 | 9 | |
itbusch | 0:f53860730a45 | 10 | |
itbusch | 0:f53860730a45 | 11 | int main() |
itbusch | 0:f53860730a45 | 12 | { |
itbusch | 0:f53860730a45 | 13 | M1_PWM.period_ms(10); // PWM-Periode |
itbusch | 0:f53860730a45 | 14 | while (1) |
itbusch | 0:f53860730a45 | 15 | { |
itbusch | 0:f53860730a45 | 16 | if (CableSwitch == false) |
itbusch | 0:f53860730a45 | 17 | { |
itbusch | 0:f53860730a45 | 18 | M1_DIR = 1; |
itbusch | 0:f53860730a45 | 19 | M1_PWM = 0.5; //Tastgrad 0-1 |
itbusch | 0:f53860730a45 | 20 | } |
itbusch | 0:f53860730a45 | 21 | else |
itbusch | 0:f53860730a45 | 22 | { |
itbusch | 0:f53860730a45 | 23 | M1_DIR = 1; |
itbusch | 0:f53860730a45 | 24 | M1_PWM = 0.95; |
itbusch | 0:f53860730a45 | 25 | } |
itbusch | 0:f53860730a45 | 26 | } |
itbusch | 0:f53860730a45 | 27 | } |