tac
Dependencies: mbed
Revision 0:3ba0b3ceda17, committed 2017-11-21
- Comitter:
- idied
- Date:
- Tue Nov 21 19:02:44 2017 +0000
- Commit message:
- tach
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 3ba0b3ceda17 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Nov 21 19:02:44 2017 +0000 @@ -0,0 +1,23 @@ +#include "mbed.h" + +DigitalOut myled(LED1); + +AnalogIn ain(A0); //initialize input +Timer t; //initialize timer +float rpm; //declare rpm variable + +int main() { + + while(1){ //do always + if (A0 != 0){ //senses beam crossing + while (A0 == 0) { //no longer senses + t.start(); //start timer + } + t.stop(); //stop timer + rpm = t.read()*60; //obtain value of rpm + } + } + + + +}
diff -r 000000000000 -r 3ba0b3ceda17 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Nov 21 19:02:44 2017 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/e7ca05fa8600 \ No newline at end of file