timer reference. on 1114-mbed
Revision 0:2a4387a90647, committed 2015-01-28
- Comitter:
- kazu_zamasu
- Date:
- Wed Jan 28 14:02:25 2015 +0000
- Child:
- 1:57ee27a9df19
- Commit message:
- timer
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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Wed Jan 28 14:02:25 2015 +0000
@@ -0,0 +1,26 @@
+#include "mbed.h"
+Timer TSGtimer;
+
+DigitalIn TSG(dp17,PullUp);
+DigitalOut DLEDG(dp14,0);
+Serial pc(USBTX, USBRX);
+
+int hoges,hogee;
+int main() {
+pc.baud(115200);
+while(1) {
+
+DLEDG = !TSG;
+if ( TSG == 1 && 0 != TSGtimer.read_ms()){
+TSGtimer.reset();
+TSGtimer.stop();
+}
+else if ( TSG == 0){
+TSGtimer.start();
+hogee=TSGtimer.read_ms();
+printf("\033[4;1H");
+printf("\033[K");
+printf("TSG-on times by msec %d\n", hogee);
+}
+}
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jan 28 14:02:25 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file
Kazu Zamasu