![](/media/cache/profiles/795c7a7a5ec6b460ec00c5841019b9e9.jpg.50x50_q85.jpg)
code sample for workshop
Diff: main.cpp
- Revision:
- 0:228cf6908a24
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Apr 13 07:38:02 2015 +0000 @@ -0,0 +1,15 @@ +#include "mbed.h" + +DigitalOut myled( LED1 ); +DigitalIn input( p5 ); +Serial ser( USBTX, USBRX ); + +int main() { + input.mode( PullUp ); + + while(1) { + myled = !input; + ser.printf( "switch is %s\r\n", input ? "OFF" : "ON" ); + wait( 0.5 ); + } +}