Robert Schulte
/
frdm_MotorTryout
Motor tryout, nog niet volledigwerkend.
main.cpp
- Committer:
- Rvs94
- Date:
- 2015-09-19
- Revision:
- 0:97d039743c1c
File content as of revision 0:97d039743c1c:
#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; } } }