Lehrer Busch
/
110_robot_H_Bridge8835_UserButton_DIR_PWM
110_robot_H_Bridge8835_UserButton_DIR_PWM
main.cpp@1:2849454dd0ab, 2022-02-04 (annotated)
- Committer:
- itbusch
- Date:
- Fri Feb 04 14:43:31 2022 +0000
- Revision:
- 1:2849454dd0ab
- Parent:
- 0:f53860730a45
- Child:
- 2:5d1d6ad41669
110_robot_H_Bridge8835_UserButton_DIR_PWM
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
itbusch | 1:2849454dd0ab | 1 | /* mbed BuschA*/ |
itbusch | 0:f53860730a45 | 2 | |
itbusch | 0:f53860730a45 | 3 | #include "mbed.h" |
itbusch | 0:f53860730a45 | 4 | |
itbusch | 1:2849454dd0ab | 5 | DigitalIn User_Button(PC_13); //PullUp auf Board, PC13 |
itbusch | 0:f53860730a45 | 6 | PwmOut M1_PWM(D9); |
itbusch | 0:f53860730a45 | 7 | DigitalOut M1_DIR(D7); |
itbusch | 0:f53860730a45 | 8 | |
itbusch | 0:f53860730a45 | 9 | |
itbusch | 0:f53860730a45 | 10 | int main() |
itbusch | 0:f53860730a45 | 11 | { |
itbusch | 0:f53860730a45 | 12 | M1_PWM.period_ms(10); // PWM-Periode |
itbusch | 0:f53860730a45 | 13 | while (1) |
itbusch | 0:f53860730a45 | 14 | { |
itbusch | 1:2849454dd0ab | 15 | if (User_Button == false) |
itbusch | 0:f53860730a45 | 16 | { |
itbusch | 0:f53860730a45 | 17 | M1_DIR = 1; |
itbusch | 0:f53860730a45 | 18 | M1_PWM = 0.5; //Tastgrad 0-1 |
itbusch | 0:f53860730a45 | 19 | } |
itbusch | 0:f53860730a45 | 20 | else |
itbusch | 0:f53860730a45 | 21 | { |
itbusch | 1:2849454dd0ab | 22 | M1_DIR = 0; |
itbusch | 0:f53860730a45 | 23 | M1_PWM = 0.95; |
itbusch | 0:f53860730a45 | 24 | } |
itbusch | 0:f53860730a45 | 25 | } |
itbusch | 0:f53860730a45 | 26 | } |