RRI data

Fork of BLENano2_AD_Serial by electric baka

main.cpp

Committer:
electricbaka
Date:
2018-09-20
Revision:
2:2b070a0b5e17
Parent:
1:0cf0e8648390
Child:
3:01f92b787f26

File content as of revision 2:2b070a0b5e17:

/*
 *
 *    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);
    }
}