![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
テストモード追加、LED有効化 left -> SerialRX, Data Recieve Complete , Serial Tx , Light Tx
Dependencies: XBee mbed NetServicesMin
common/leds.cpp@1:36eb173eb52b, 2012-04-15 (annotated)
- Committer:
- recotana
- Date:
- Sun Apr 15 13:09:53 2012 +0000
- Revision:
- 1:36eb173eb52b
- Parent:
- 0:42adca80439c
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
recotana | 0:42adca80439c | 1 | #include "mbed.h" |
recotana | 0:42adca80439c | 2 | #include "leds.h" |
recotana | 0:42adca80439c | 3 | |
recotana | 1:36eb173eb52b | 4 | Timeout timer1; |
recotana | 1:36eb173eb52b | 5 | Timeout timer2; |
recotana | 1:36eb173eb52b | 6 | Timeout timer3; |
recotana | 1:36eb173eb52b | 7 | Timeout timer4; |
recotana | 0:42adca80439c | 8 | |
recotana | 1:36eb173eb52b | 9 | DigitalOut led1(LED1); |
recotana | 1:36eb173eb52b | 10 | DigitalOut led2(LED2); |
recotana | 1:36eb173eb52b | 11 | DigitalOut led3(LED3); |
recotana | 1:36eb173eb52b | 12 | DigitalOut led4(LED4); |
recotana | 1:36eb173eb52b | 13 | |
recotana | 1:36eb173eb52b | 14 | extern Serial pc; |
recotana | 0:42adca80439c | 15 | |
recotana | 1:36eb173eb52b | 16 | void offSerialRx(void){ |
recotana | 1:36eb173eb52b | 17 | led1=0; |
recotana | 0:42adca80439c | 18 | } |
recotana | 1:36eb173eb52b | 19 | |
recotana | 1:36eb173eb52b | 20 | void offSerialDataCmp(void){ |
recotana | 1:36eb173eb52b | 21 | led2=0; |
recotana | 1:36eb173eb52b | 22 | |
recotana | 0:42adca80439c | 23 | } |
recotana | 1:36eb173eb52b | 24 | void offSerialTx(void){ |
recotana | 1:36eb173eb52b | 25 | led3=0; |
recotana | 1:36eb173eb52b | 26 | } |
recotana | 1:36eb173eb52b | 27 | void offLightlTx(void){ |
recotana | 1:36eb173eb52b | 28 | led4=0; |
recotana | 0:42adca80439c | 29 | } |
recotana | 0:42adca80439c | 30 | |
recotana | 1:36eb173eb52b | 31 | void ledSerialRx(void) |
recotana | 0:42adca80439c | 32 | { |
recotana | 1:36eb173eb52b | 33 | if(led1 == 1) return; |
recotana | 1:36eb173eb52b | 34 | led1=1; |
recotana | 1:36eb173eb52b | 35 | timer1.attach(&offSerialRx,kLedOnTime); |
recotana | 0:42adca80439c | 36 | } |
recotana | 1:36eb173eb52b | 37 | void ledSerialDataCmp(void) |
recotana | 0:42adca80439c | 38 | { |
recotana | 1:36eb173eb52b | 39 | led2=1; |
recotana | 1:36eb173eb52b | 40 | timer2.attach(&offSerialDataCmp,kLedOnTime); |
recotana | 0:42adca80439c | 41 | } |
recotana | 1:36eb173eb52b | 42 | void ledSerialTx(void) |
recotana | 0:42adca80439c | 43 | { |
recotana | 1:36eb173eb52b | 44 | led3=1; |
recotana | 1:36eb173eb52b | 45 | timer3.attach(&offSerialTx,kLedOnTime); |
recotana | 0:42adca80439c | 46 | } |
recotana | 1:36eb173eb52b | 47 | void ledLightTx(void) |
recotana | 0:42adca80439c | 48 | { |
recotana | 1:36eb173eb52b | 49 | led4=1; |
recotana | 1:36eb173eb52b | 50 | timer4.attach(&offLightlTx,kLedOnTime); |
recotana | 0:42adca80439c | 51 | } |
recotana | 0:42adca80439c | 52 | |
recotana | 1:36eb173eb52b | 53 | void startLed(void) |
recotana | 0:42adca80439c | 54 | { |
recotana | 1:36eb173eb52b | 55 | |
recotana | 1:36eb173eb52b | 56 | led1=1; |
recotana | 1:36eb173eb52b | 57 | wait(0.2); |
recotana | 1:36eb173eb52b | 58 | led1=0; |
recotana | 1:36eb173eb52b | 59 | |
recotana | 1:36eb173eb52b | 60 | led2=1; |
recotana | 1:36eb173eb52b | 61 | wait(0.2); |
recotana | 1:36eb173eb52b | 62 | led2=0; |
recotana | 1:36eb173eb52b | 63 | |
recotana | 1:36eb173eb52b | 64 | led3=1; |
recotana | 1:36eb173eb52b | 65 | wait(0.2); |
recotana | 1:36eb173eb52b | 66 | led3=0; |
recotana | 1:36eb173eb52b | 67 | |
recotana | 1:36eb173eb52b | 68 | led4=1; |
recotana | 1:36eb173eb52b | 69 | wait(0.2); |
recotana | 1:36eb173eb52b | 70 | led4=0; |
recotana | 1:36eb173eb52b | 71 | |
recotana | 1:36eb173eb52b | 72 | wait(0.4); |
recotana | 1:36eb173eb52b | 73 | |
recotana | 1:36eb173eb52b | 74 | led1=1; |
recotana | 1:36eb173eb52b | 75 | led2=1; |
recotana | 1:36eb173eb52b | 76 | led3=1; |
recotana | 1:36eb173eb52b | 77 | led4=1; |
recotana | 1:36eb173eb52b | 78 | wait(0.05); |
recotana | 1:36eb173eb52b | 79 | |
recotana | 1:36eb173eb52b | 80 | led1=0; |
recotana | 1:36eb173eb52b | 81 | led2=0; |
recotana | 1:36eb173eb52b | 82 | led3=0; |
recotana | 1:36eb173eb52b | 83 | led4=0; |
recotana | 1:36eb173eb52b | 84 | wait(0.1); |
recotana | 1:36eb173eb52b | 85 | |
recotana | 1:36eb173eb52b | 86 | led1=1; |
recotana | 1:36eb173eb52b | 87 | led2=1; |
recotana | 1:36eb173eb52b | 88 | led3=1; |
recotana | 1:36eb173eb52b | 89 | led4=1; |
recotana | 1:36eb173eb52b | 90 | wait(0.05); |
recotana | 1:36eb173eb52b | 91 | |
recotana | 1:36eb173eb52b | 92 | led1=0; |
recotana | 1:36eb173eb52b | 93 | led2=0; |
recotana | 1:36eb173eb52b | 94 | led3=0; |
recotana | 1:36eb173eb52b | 95 | led4=0; |
recotana | 1:36eb173eb52b | 96 | |
recotana | 1:36eb173eb52b | 97 | |
recotana | 0:42adca80439c | 98 | } |