Kyle Zampaglione
/
SlotSensorsTest
Code for Slot Sensor readout. Prints to text file on mbed.
main.cpp
- Committer:
- kzampag
- Date:
- 2013-07-02
- Revision:
- 2:c789547682d8
- Parent:
- 0:6aa040f8bf2c
- Child:
- 3:a93f3494e6c1
File content as of revision 2:c789547682d8:
#include "mbed.h" Serial pc(USBTX, USBRX); // tx, rx DigitalIn sensor1(p11); DigitalIn sensor2(p12); Timer t; Timer timer1; int change = 0; int main() { pc.printf("Break sensor to start timer \n \r"); while(1) { if (change == 0 && sensor1) { change = 1; t.reset(); t.start(); pc.printf("Start \n \r"); } if (change && sensor2) { t.stop(); pc.printf("End. Time taken was %f seconds \n \r", t.read()); change = 0; } } }