Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of Test1 by
Revision 0:1da3cc3bc3a5, committed 2010-12-02
- Comitter:
- powerstrokediesel97
- Date:
- Thu Dec 02 07:21:02 2010 +0000
- Commit message:
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 1da3cc3bc3a5 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Dec 02 07:21:02 2010 +0000
@@ -0,0 +1,59 @@
+#include "mbed.h"
+
+Serial transmit(p28,p27);
+Timer t;
+InterruptIn risingEdge(p16);
+
+DigitalOut myled(LED1);
+DigitalOut myled2(LED2);
+
+long int count;
+
+//Increment the counter variable
+void pulses() {
+ if(myled2 == 1) {
+ myled2 = 0;
+ } else {
+ myled2 = 1;
+ }
+ count++;
+}
+
+//main program
+int main() {
+
+ risingEdge.rise(&pulses);
+
+ while(1) {
+
+ // myled = 0;
+
+ t.reset();
+ t.start();
+ count = 0;
+ while(t.read_ms() < 400) {
+ ;
+ }
+
+ t.stop();
+ // myled = 1;
+ long int temp = count;
+ // lcdout.putc(0xFE);
+ // lcdout.putc(0x01);
+ // lcdout.printf("Count: %d\n", temp);
+ // transmit.printf("Count: %d", temp);
+ double rev = (double)temp/30.0;
+ double sec = 1000.0/(double)t.read_ms();
+ double rps = rev * sec;
+ double rpm = rps*60.0;
+ int irpm = (int)rpm;
+
+ //lcdout.printf("Speed: %0.2f RPM", rpm);
+ // transmit.printf(" Speed: %0.2f RPM", rpm);
+ transmit.printf("%d", irpm);
+ // transmit.putc(0xA);
+ transmit.putc(0xD);
+ }
+}
+
+
diff -r 000000000000 -r 1da3cc3bc3a5 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Dec 02 07:21:02 2010 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e
