kg

Dependencies:   mbed

main.cpp

Committer:
mexinguer
Date:
2017-02-06
Revision:
0:fbf47740c05e

File content as of revision 0:fbf47740c05e:

#include "mbed.h"
//#include "c12632.h"

DigitalOut LED(D13);
DigitalIn BP(PC_13,PullNone);
AnalogIn pot1(PA_0);
Serial pc(SERIAL_TX, SERIAL_RX);

int main()
{
    unsigned char cpt=0;
    pc.baud(38400);
    int temps_us, mesure;
    Timer t;    
    
    
    while(1) 
    {
        t.start();
        cpt++;
        mesure=pot1.read_u16();
        
        if(cpt==10)
        {
            t.stop();
            temps_us=t.read_us();
            pc.printf("%d \n",temps_us);
            cpt=0;
            t.reset();
        }        
    }
}