Gabriel Velasco
/
mbed_blinky_seeed
Testing stuff
Diff: main.cpp
- Revision:
- 0:f95a24befabd
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Jun 15 20:25:09 2018 +0000 @@ -0,0 +1,31 @@ +#include "mbed.h" + +DigitalOut myled(LED1); +DigitalOut led2(LED2); +DigitalOut led3(LED3); + +AnalogIn adc(P0_26); +Serial serial(P0_0, P0_1, 19200); + +int main() { + + + while(1) { + myled = 1; + wait(0.2); + myled = 0; + wait(0.2); + + serial.printf("%5d\n\r", adc.read_u16()); + if(adc.read_u16() > (0xFFFF / 2)) + { + led2 = 1; + led3 = 0; + } + else + { + led2 = 0; + led3 = 1; + } + } +}