Kazu Zamasu / Mbed 2 deprecated mbed_timer

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 Timer TSGtimer;
00003  
00004 DigitalIn TSG(dp17,PullUp);
00005 DigitalOut DLEDG(dp14,0);
00006 Serial pc(USBTX, USBRX);
00007  
00008 int hoges,hogee;
00009 int main() {
00010 pc.baud(115200);
00011 while(1) {
00012  
00013 DLEDG = !TSG;
00014 if ( TSG == 1 && 0 != TSGtimer.read_ms()){
00015 TSGtimer.stop();
00016 TSGtimer.reset();
00017 }
00018 else if ( TSG == 0){
00019 TSGtimer.start();
00020 hogee=TSGtimer.read_ms();
00021 printf("\033[4;1H");
00022 printf("\033[K");
00023 printf("TSG-on times by msec %d\n", hogee);
00024 }
00025 }
00026 }