![](/media/cache/profiles/2ac350bd5fbdda63bd410978526a2388.jpg.50x50_q85.png)
Testing with Daniel
Dependencies: mbed Blinker TextLCD
main.cpp
- Committer:
- jurgis
- Date:
- 2017-01-07
- Revision:
- 1:b95c3509df0f
- Parent:
- 0:fdb33524a029
- Child:
- 2:458dfec0820c
File content as of revision 1:b95c3509df0f:
// Testing MBED with Daniel #include "mbed.h" DigitalOut led1(LED1); DigitalOut greenLed(D8); DigitalIn button(D9); Serial pc(USBTX, USBRX); double ledWait = 0.2; // sec double getWaitTime() { double waitTime = (button == 0) ? 0.2 : 1.0; pc.printf("waitTime: %0.1f\r\n", waitTime); return waitTime; } int main() { greenLed = 0; pc.baud(115200); pc.printf("Hello world\r\n"); while(1) { pc.printf("ON\r\n"); led1 = 1; // LED is ON greenLed = 0; wait(getWaitTime()); pc.printf("OFF\r\n"); led1 = 0; // LED is OFF greenLed = 1; wait(getWaitTime()); } }