electric baka
/
BLENano2_AD_Serial_RRI
RRI data
Fork of BLENano2_AD_Serial by
Diff: main.cpp
- Revision:
- 0:a0dadd2b7bfa
- Child:
- 1:0cf0e8648390
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Jul 11 09:50:02 2018 +0000 @@ -0,0 +1,42 @@ +/* + * + * BLE Nano2 : USB Serial Communication + * + * http://jellyware.jp/kurage/ + * + */ + + +//------------------------------------------------------------ +//Include Header Files +//------------------------------------------------------------ +#include "mbed.h" + + +//------------------------------------------------------------ +//Definition +//------------------------------------------------------------ +#define ANALOG_IN_PIN1 P0_5 + + +//------------------------------------------------------------ +//Object generation +//------------------------------------------------------------ +AnalogIn ANALOG1(ANALOG_IN_PIN1); +Serial pc(P0_29, P0_30); + +int main(void) +{ + pc.baud(9600); + char str[10]; + + while (true) { + float s = ANALOG1; + uint16_t value = s * 1024; + + sprintf(str, "%d\r\n", value); + pc.printf(str); + + wait_ms(1); + } +} \ No newline at end of file