Fernon Eijkhoudt
/
ROBOBIRDS_FINAL
EMG driven robot which shoots elastic bands
Fork of RoboBirdV1 by
main.cpp@0:5a5f417fa1b2, 2015-09-23 (annotated)
- Committer:
- Fernon
- Date:
- Wed Sep 23 09:07:24 2015 +0000
- Revision:
- 0:5a5f417fa1b2
- Child:
- 1:bb11e38dda43
Motor 1 werkend, Richting wordt elke seconde afgewisseld
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Fernon | 0:5a5f417fa1b2 | 1 | #include "mbed.h" |
Fernon | 0:5a5f417fa1b2 | 2 | #include "QEI.h" |
Fernon | 0:5a5f417fa1b2 | 3 | |
Fernon | 0:5a5f417fa1b2 | 4 | //Motor 2 D4 en D5 |
Fernon | 0:5a5f417fa1b2 | 5 | //D4 direction |
Fernon | 0:5a5f417fa1b2 | 6 | //D5 PWM |
Fernon | 0:5a5f417fa1b2 | 7 | |
Fernon | 0:5a5f417fa1b2 | 8 | DigitalOut Direction(D4); //1 = CCW - 0 = CW |
Fernon | 0:5a5f417fa1b2 | 9 | PwmOut PowerMotor(D5); |
Fernon | 0:5a5f417fa1b2 | 10 | // hier nog signaal encoder |
Fernon | 0:5a5f417fa1b2 | 11 | |
Fernon | 0:5a5f417fa1b2 | 12 | int main() |
Fernon | 0:5a5f417fa1b2 | 13 | { |
Fernon | 0:5a5f417fa1b2 | 14 | while (true) { |
Fernon | 0:5a5f417fa1b2 | 15 | for (int n = 0; n < 2; n++) { |
Fernon | 0:5a5f417fa1b2 | 16 | Direction.write(0); |
Fernon | 0:5a5f417fa1b2 | 17 | PowerMotor.write(0.5); |
Fernon | 0:5a5f417fa1b2 | 18 | wait (1); |
Fernon | 0:5a5f417fa1b2 | 19 | Direction.write(1); |
Fernon | 0:5a5f417fa1b2 | 20 | wait (1); |
Fernon | 0:5a5f417fa1b2 | 21 | } |
Fernon | 0:5a5f417fa1b2 | 22 | PowerMotor.write(0); |
Fernon | 0:5a5f417fa1b2 | 23 | return (0); |
Fernon | 0:5a5f417fa1b2 | 24 | } |
Fernon | 0:5a5f417fa1b2 | 25 | } |