Werkcollege opgave 23 september BMT K9
Dependencies: Encoder HIDScope MODSERIAL mbed QEI biquadFilter
main.cpp@10:2f76fa4cd2a7, 2015-10-01 (annotated)
- Committer:
- bscheltinga
- Date:
- Thu Oct 01 13:25:04 2015 +0000
- Revision:
- 10:2f76fa4cd2a7
- Parent:
- 9:832b48f48a10
- Child:
- 11:73817c9df1e5
Motor laten acceleren met PWM out functie;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bscheltinga | 0:fe3896c6eeb0 | 1 | #include "mbed.h" |
bscheltinga | 0:fe3896c6eeb0 | 2 | #include "encoder.h" |
bscheltinga | 0:fe3896c6eeb0 | 3 | #include "MODSERIAL.h" |
bscheltinga | 0:fe3896c6eeb0 | 4 | |
bscheltinga | 0:fe3896c6eeb0 | 5 | //Motor 2 |
bscheltinga | 0:fe3896c6eeb0 | 6 | DigitalOut motor2direction(D4); //D4 en D5 zijn motor 2 (op het motorshield) |
bscheltinga | 0:fe3896c6eeb0 | 7 | PwmOut motor2speed(D5); |
bscheltinga | 10:2f76fa4cd2a7 | 8 | //DigitalIn buttonL1(PTC6); |
bscheltinga | 10:2f76fa4cd2a7 | 9 | //DigitalIn buttonL2(PTA4); |
bscheltinga | 10:2f76fa4cd2a7 | 10 | //DigitalIn buttonH1(D2); |
bscheltinga | 10:2f76fa4cd2a7 | 11 | //DigitalIn buttonH2(D6); |
bscheltinga | 10:2f76fa4cd2a7 | 12 | //AnalogIn potmeter(A1); |
bscheltinga | 4:96e47998d495 | 13 | |
bscheltinga | 0:fe3896c6eeb0 | 14 | |
bscheltinga | 0:fe3896c6eeb0 | 15 | int main() |
bscheltinga | 0:fe3896c6eeb0 | 16 | { |
bscheltinga | 10:2f76fa4cd2a7 | 17 | for(float p = 0.0f; p < 1.0f; p += 0.01f) { |
bscheltinga | 10:2f76fa4cd2a7 | 18 | motor2speed = p; |
bscheltinga | 10:2f76fa4cd2a7 | 19 | wait(1); |
bscheltinga | 10:2f76fa4cd2a7 | 20 | break; |
bscheltinga | 0:fe3896c6eeb0 | 21 | } |
bscheltinga | 10:2f76fa4cd2a7 | 22 | } |