create and send the file to pc
Dependencies: MCP23017 WattBob_TextLCD mbed
Fork of HelloWorld by
Diff: main.cpp
- Revision:
- 4:b5b159adc261
- Parent:
- 3:6cc06b58870b
- Child:
- 5:27b1b41b2366
diff -r 6cc06b58870b -r b5b159adc261 main.cpp --- a/main.cpp Fri Feb 14 12:50:29 2014 +0000 +++ b/main.cpp Wed Feb 26 11:30:18 2014 +0000 @@ -1,15 +1,16 @@ #include "mbed.h" +//#include "mon.cpp" -DigitalIn 1sIP(p5); -DigitalIn 400msIP1(p6); -DigitalIn 400msIP2(p7); -AnalogIn 800msIP1(p19); -AnalogIn 800msIP2(p20); +DigitalIn IP1s(p5); +DigitalIn IP1_400ms(p6); +DigitalIn IP2_400ms(p7); +AnalogIn IP1_800ms(p19); +AnalogIn IP2_800ms(p20); -DIgitalOut bit4(LED1); -DIgitalOut bit3(LED2); -DIgitalOut bit2(LED3); -DIgitalOut bit1(LED4); +DigitalOut bit4(LED1); +DigitalOut bit3(LED2); +DigitalOut bit2(LED3); +DigitalOut bit1(LED4); int IP1s,IP400ms1,IP400ms2 = 0; int IP800ms1[4],IP800ms2[4] = 0; @@ -36,17 +37,17 @@ { IP1s = 0; for(int i = 0; i < 1000; i++) //the accuracy is 1us - if(1sIP == 1) + if(IP1s == 1) IP1s++; //the lasting time of the impulse of square wave } void task2_checkDIP400ms() //check the SWes per 400ms { - if( 400msIP1 != 0 ) + if( IP1_400ms != 0 ) IP400ms1 = 1; else IP400ms1 = 0; - if( 400msIP2 !=0 ) + if( IP2_400ms !=0 ) IP400ms2 = 1; else TP400ms2 = 0; @@ -54,8 +55,8 @@ void task3_checkAIP800ms() { - IP800ms1[flag4task3] = 800msIP1; - IP800ms2[flag4task3] = 800msIP2; + IP800ms1[flag4task3] = IP1_800ms; + IP800ms2[flag4task3] = IP2_800ms; flag4task3++; flag4task3 = flag4task3%4;