![](/media/cache/profiles/cc38c8ffd23cef2e3e5c21d20c1db636.jpg.50x50_q85.png)
all publish
main.cpp@0:e8affd8e420a, 2019-05-06 (annotated)
- Committer:
- daikinect
- Date:
- Mon May 06 00:21:44 2019 +0000
- Revision:
- 0:e8affd8e420a
all publish
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
daikinect | 0:e8affd8e420a | 1 | #include "mbed.h" |
daikinect | 0:e8affd8e420a | 2 | #define NOD 3 |
daikinect | 0:e8affd8e420a | 3 | char rx_buffer[NOD]; |
daikinect | 0:e8affd8e420a | 4 | Serial xbee(D1,D0,9600); |
daikinect | 0:e8affd8e420a | 5 | DigitalOut myled(LED1); |
daikinect | 0:e8affd8e420a | 6 | |
daikinect | 0:e8affd8e420a | 7 | const event_callback_t callbackr() |
daikinect | 0:e8affd8e420a | 8 | { |
daikinect | 0:e8affd8e420a | 9 | } |
daikinect | 0:e8affd8e420a | 10 | public void rx_callback() |
daikinect | 0:e8affd8e420a | 11 | { |
daikinect | 0:e8affd8e420a | 12 | xbee.read(rx_buffer,NOD,&callbackr); |
daikinect | 0:e8affd8e420a | 13 | } |
daikinect | 0:e8affd8e420a | 14 | int main() |
daikinect | 0:e8affd8e420a | 15 | { |
daikinect | 0:e8affd8e420a | 16 | xbee.attach(&rx_callback); |
daikinect | 0:e8affd8e420a | 17 | while(1) { |
daikinect | 0:e8affd8e420a | 18 | myled = 1; // LED is ON |
daikinect | 0:e8affd8e420a | 19 | wait(0.2); // 200 ms |
daikinect | 0:e8affd8e420a | 20 | myled = 0; // LED is OFF |
daikinect | 0:e8affd8e420a | 21 | wait(1.0); // 1 sec |
daikinect | 0:e8affd8e420a | 22 | } |
daikinect | 0:e8affd8e420a | 23 | } |