Robert Schulte
/
frdm_MotorTryout
Motor tryout, nog niet volledigwerkend.
Diff: main.cpp
- Revision:
- 0:97d039743c1c
diff -r 000000000000 -r 97d039743c1c main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Sep 19 10:06:45 2015 +0000 @@ -0,0 +1,42 @@ +#include "mbed.h" +#include "HIDScope.h" + +DigitalOut motor2direction(D4); //D4 en D5 zijn motor 2 (op het motorshield) +PwmOut motor2speed(D5); +DigitalOut motor1direction(D7); //D6 en D7 voor motor 1 (op het motorshield) +PwmOut motor1speed(D6); +DigitalOut led(LED1); +Serial pc(USBTX,USBRX); + +int main() +{ + + pc.baud(9600); + char c = pc.getc(); + while(true) + { + switch(c) + { + case 'r': + motor2direction = 1; + motor2speed = 0.5f; + led = 0; + wait(0.5f); + pc.printf("R\n"); + break; + + case 't': + motor2direction = 0; + motor2speed = 0.5f; + led = 0; + wait(0.5f); + pc.printf("T\n"); + break; + + default: + motor2direction = 0; + motor2speed = 0; + led = 1; + } + } +} \ No newline at end of file