Tedd OKANO
/
__Serial_sample
sample code for workshop
Diff: main.cpp
- Revision:
- 0:9300e8ff8060
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Apr 13 01:53:40 2015 +0000 @@ -0,0 +1,13 @@ +#include "mbed.h" + +BusOut leds( LED4, LED3, LED2, LED1 ); +AnalogIn ai( p20 ); +Serial ser( USBTX, USBRX ); + +int main() { + while(1) { + leds = (int)(ai * 15.0); + ser.printf( "voltage = %.2f\r\n", ai * 3.3 ); + wait( 0.5 ); + } +}