simplify version, but need 3.3v for the photodiode

Dependencies:   mbed

Fork of Nucleo_read_analog_value by Robocon_IPS

main.cpp

Committer:
iskenny4
Date:
2017-06-01
Revision:
1:5bc3306dd478
Parent:
0:f3b9844205f2

File content as of revision 1:5bc3306dd478:

#include "mbed.h"
InterruptIn sensor(PA_0);
 
Serial pc(USBTX,USBRX,115200);

Timer t;

void start() {
    t.start();
}

void stop() {
    t.stop();
    pc.printf("%f seconds\n", t.read());
    t.reset();
}

int main() {
    pc.format(8,SerialBase::None,1);
    sensor.fall(&start);    // voltage drops below 3.3v
    sensor.rise(&stop);     // voltage rises above 3.3v
    while(1);
}