Code for Slot Sensor readout. Prints to text file on mbed.

Dependencies:   DebounceIn mbed

main.cpp

Committer:
kzampag
Date:
2013-07-02
Revision:
1:b057042a9427
Parent:
0:6aa040f8bf2c

File content as of revision 1:b057042a9427:

#include "mbed.h"
#include "DebounceIn.h"

Serial pc(USBTX, USBRX); // tx, rx


DebounceIn sensor1(p11);
DebounceIn sensor2(p12);

Timer t;



int main()
{
    pc.printf("Break sensor to start timer \n \r");

    while(1) {
   
        if (sensor1) {
            t.reset();
            t.start();
            pc.printf("Start \n \r");


        } // end sensor 1


        if (sensor2) {
            t.stop();
            pc.printf("End. Time taken was %f seconds \n \r", t.read());


        } // end sensor2

    }
}