Matthias Praja
/
BERTL14_MOTOR_PWM
Motor
Fork of BERTL14_MOTOR_PWM by
main.cpp@1:75558096c7e0, 2016-01-08 (annotated)
- Committer:
- Matthias_Praja
- Date:
- Fri Jan 08 16:00:22 2016 +0000
- Revision:
- 1:75558096c7e0
- Parent:
- 0:8487a0785e95
Bertl-Motor
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bulme_rai | 0:8487a0785e95 | 1 | /*********************************** |
bulme_rai | 0:8487a0785e95 | 2 | name: BERTL_2014_MOTOR_PWM |
bulme_rai | 0:8487a0785e95 | 3 | author: Wolfgang Raimann |
bulme_rai | 0:8487a0785e95 | 4 | email: rai@bulme.at |
bulme_rai | 0:8487a0785e95 | 5 | description: |
bulme_rai | 0:8487a0785e95 | 6 | Der Bertl dreht sich im Kreis für 1s mit 50% danach steht er für 1s |
bulme_rai | 0:8487a0785e95 | 7 | ***********************************/ |
bulme_rai | 0:8487a0785e95 | 8 | |
bulme_rai | 0:8487a0785e95 | 9 | #include "mbed.h" |
bulme_rai | 0:8487a0785e95 | 10 | |
bulme_rai | 0:8487a0785e95 | 11 | PwmOut MotorL_EN(p34); |
bulme_rai | 0:8487a0785e95 | 12 | DigitalOut MotorL_FORWARD(P1_0); |
bulme_rai | 0:8487a0785e95 | 13 | DigitalOut MotorL_REVERSE(P1_1); |
bulme_rai | 0:8487a0785e95 | 14 | |
bulme_rai | 0:8487a0785e95 | 15 | PwmOut MotorR_EN(p36); |
bulme_rai | 0:8487a0785e95 | 16 | DigitalOut MotorR_FORWARD(P1_3); |
bulme_rai | 0:8487a0785e95 | 17 | DigitalOut MotorR_REVERSE(P1_4); |
bulme_rai | 0:8487a0785e95 | 18 | |
bulme_rai | 0:8487a0785e95 | 19 | int main() { |
bulme_rai | 0:8487a0785e95 | 20 | // Richtungen werden bestimmt |
Matthias_Praja | 1:75558096c7e0 | 21 | MotorL_FORWARD = 1 |
Matthias_Praja | 1:75558096c7e0 | 22 | MotorR_FORWARD = 0; |
bulme_rai | 0:8487a0785e95 | 23 | // Periodendauer wird eingestellt |
bulme_rai | 0:8487a0785e95 | 24 | MotorL_EN.period_ms(10); |
bulme_rai | 0:8487a0785e95 | 25 | MotorR_EN.period_ms(10); |
bulme_rai | 0:8487a0785e95 | 26 | |
bulme_rai | 0:8487a0785e95 | 27 | while(1) { |
Matthias_Praja | 1:75558096c7e0 | 28 | MotorL_EN = 10.0f; |
bulme_rai | 0:8487a0785e95 | 29 | MotorR_EN.pulsewidth_ms(5); |
Matthias_Praja | 1:75558096c7e0 | 30 | |
Matthias_Praja | 1:75558096c7e0 | 31 | MotorL_EN = 10.0f; |
bulme_rai | 0:8487a0785e95 | 32 | MotorR_EN.pulsewidth_ms(0); |
Matthias_Praja | 1:75558096c7e0 | 33 | |
bulme_rai | 0:8487a0785e95 | 34 | } |
bulme_rai | 0:8487a0785e95 | 35 | } |