use additional counter with ticker for WDR
Dependencies: libmDot mbed-rtos mbed
Fork of CardRead_20170613 by
main.cpp
- Committer:
- Dengjj
- Date:
- 2017-06-17
- Revision:
- 20:d19c1cec6d42
- Parent:
- 19:a0e9128dec64
File content as of revision 20:d19c1cec6d42:
#include "mbed.h" #include "mDot.h" #include "MTSLog.h" #include <string> #include <vector> #include <algorithm> #include <math.h> #define RETURN_OK 0 #define RETURN_ERR -1 //define baudrate #define PC_BAUDRATE 115200 #define CARD_MACHINE_BAUDRATE 19200 #define COMMAND_LENGTH 7 #define RESPONSE_LENGTH 16 #define RINGBUFFER_SIZE 100 #define READ_PERIOD 1 #define SEND_PERIOD 5 Serial pc (USBTX, USBRX); Ticker timer; DigitalOut led1(PA_2); DigitalOut led2(PA_3); int flip = 0; int abc = 0; mDot* dot; void attime() { flip = !flip; abc = abc +1; if (abc == 2){ abc = 0; dot-> resetCpu(); } } int main() { pc.baud(PC_BAUDRATE); pc.printf("11111"); timer.attach(&attime, 5); pc.printf("22222"); while(1) { if(flip == 0) { led1 = !led1; } else { led2 = !led2; } pc.printf("33333"); wait(1); abc = 0; } }