Werkend motorscript met led feedback
Dependencies: Encoder MODSERIAL mbed
main.cpp
- Committer:
- Rvs94
- Date:
- 2015-09-21
- Revision:
- 3:051c91b04acd
- Parent:
- 2:2b8a8be38c85
File content as of revision 3:051c91b04acd:
#include "mbed.h" #include "encoder.h" #include "MODSERIAL.h" Serial pc(USBTX, USBRX); // tx, rx DigitalOut led(LED_RED); DigitalOut motor2direction(D4); //D4 en D5 zijn motor 2 (op het motorshield) PwmOut motor2speed(D5); DigitalIn button1(SW3); int main() { motor2direction = 0; motor2speed = 0; led = 1; pc.baud(9600); while(true) { if(button1 == 0) { motor2direction = 1; motor2speed = 0.5f; pc.printf("het werkt"); wait(1); led = 0; wait(0.2f); motor2speed = 0; led = 1; } } }