Werkcollege opgave 23 september BMT K9
Dependencies: Encoder HIDScope MODSERIAL mbed QEI biquadFilter
main.cpp@7:f01efd933bfd, 2015-09-23 (annotated)
- Committer:
- ThomasBNL
- Date:
- Wed Sep 23 16:37:25 2015 +0000
- Revision:
- 7:f01efd933bfd
- Parent:
- 1:0a89274e1279
Putty - clockwise and counterclockwise note added
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 "HIDScope.h" |
bscheltinga | 0:fe3896c6eeb0 | 3 | #include "encoder.h" |
bscheltinga | 0:fe3896c6eeb0 | 4 | #include "MODSERIAL.h" |
bscheltinga | 0:fe3896c6eeb0 | 5 | |
bscheltinga | 0:fe3896c6eeb0 | 6 | //Motor 2 |
bscheltinga | 0:fe3896c6eeb0 | 7 | DigitalOut motor2direction(D4); //D4 en D5 zijn motor 2 (op het motorshield) |
bscheltinga | 0:fe3896c6eeb0 | 8 | PwmOut motor2speed(D5); |
bscheltinga | 0:fe3896c6eeb0 | 9 | DigitalIn button(PTA4); |
ThomasBNL | 7:f01efd933bfd | 10 | MODSERIAL pc(USBTX,USBRX); |
bscheltinga | 0:fe3896c6eeb0 | 11 | |
bscheltinga | 0:fe3896c6eeb0 | 12 | int main() |
bscheltinga | 0:fe3896c6eeb0 | 13 | { |
bscheltinga | 0:fe3896c6eeb0 | 14 | while(true) { |
ThomasBNL | 7:f01efd933bfd | 15 | pc.printf("Clockwise \n"); |
bscheltinga | 1:0a89274e1279 | 16 | motor2direction = 1; |
bscheltinga | 1:0a89274e1279 | 17 | motor2speed = 0.5f; |
bscheltinga | 1:0a89274e1279 | 18 | wait (1); |
ThomasBNL | 7:f01efd933bfd | 19 | pc.printf("Counter Clockwise \n"); |
bscheltinga | 1:0a89274e1279 | 20 | motor2direction = 0; |
bscheltinga | 1:0a89274e1279 | 21 | wait (1); |
bscheltinga | 0:fe3896c6eeb0 | 22 | } |
bscheltinga | 0:fe3896c6eeb0 | 23 | } |