C++ Code for the final project, to write input data from the joystick to the serial port through the mbed.
main.cpp
- Committer:
- spoda
- Date:
- 2016-12-12
- Revision:
- 0:173425de07bf
File content as of revision 0:173425de07bf:
#include "mbed.h" Serial pc(USBTX, USBRX); DigitalIn Up(p24); DigitalIn Left(p26); DigitalIn Right(p28); DigitalIn Down(p27); int main() { while(1) { if (Up.read() == 0) { pc.printf("u\n"); } else if (Down.read() == 0) { pc.printf("d\n"); } else if (Left.read() == 0) { pc.printf("l\n"); } else if (Right.read() == 0) { pc.printf("r\n"); } wait(0.2); } }