Control an LED from a computer via the serial port
Dependencies: mbed
PhysicalPixel.cpp
- Committer:
- ethanharstad
- Date:
- 2014-06-01
- Revision:
- 0:da809d54f2ce
- Child:
- 1:c064570d8b35
File content as of revision 0:da809d54f2ce:
#include "mbed.h" // Global variables DigitalOut led(LED1); Serial pc(USBTX, USBRX); // Function prototypes void handleInput(char in); // Main function int main() { while(true) { if(pc.readable()) { char c = pc.getc(); handleInput(c); } } } // Input handler void handleInput(char in) { if(in == 'H') { led = 1; } else if(in == 'L') { led = 0; } }