Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
main.cpp@1:a47cb7834afe, 2014-06-16 (annotated)
- Committer:
- ryuna
- Date:
- Mon Jun 16 08:13:29 2014 +0000
- Revision:
- 1:a47cb7834afe
- Parent:
- 0:ae8fbdc800ba
ver.2;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ryuna | 0:ae8fbdc800ba | 1 | #include "mbed.h" |
| ryuna | 0:ae8fbdc800ba | 2 | #include <math.h> |
| ryuna | 0:ae8fbdc800ba | 3 | DigitalOut myled(LED1); |
| ryuna | 0:ae8fbdc800ba | 4 | |
| ryuna | 0:ae8fbdc800ba | 5 | Serial sensor(p13,p14); |
| ryuna | 0:ae8fbdc800ba | 6 | Serial xbee(p28,p27); |
| ryuna | 1:a47cb7834afe | 7 | enum {LEFT, BACK, RIGHT,FRONT}; |
| ryuna | 0:ae8fbdc800ba | 8 | /*XBee interrupt*/ |
| ryuna | 0:ae8fbdc800ba | 9 | Ticker xbeetx; |
| ryuna | 0:ae8fbdc800ba | 10 | Ticker xbeerx; |
| ryuna | 0:ae8fbdc800ba | 11 | |
| ryuna | 0:ae8fbdc800ba | 12 | extern void micon_rx(void); |
| ryuna | 0:ae8fbdc800ba | 13 | extern void xbee_tx(void); |
| ryuna | 0:ae8fbdc800ba | 14 | extern void xbee_rx(void); |
| ryuna | 0:ae8fbdc800ba | 15 | |
| ryuna | 1:a47cb7834afe | 16 | uint8_t ping[4] = {0}; |
| ryuna | 1:a47cb7834afe | 17 | uint8_t ir_min = 0; |
| ryuna | 1:a47cb7834afe | 18 | uint8_t ir_num = 0; |
| ryuna | 1:a47cb7834afe | 19 | uint8_t ir_main = 0; |
| ryuna | 1:a47cb7834afe | 20 | unsigned int compass = 0; |
| ryuna | 1:a47cb7834afe | 21 | |
| ryuna | 1:a47cb7834afe | 22 | |
| ryuna | 0:ae8fbdc800ba | 23 | int main() { |
| ryuna | 1:a47cb7834afe | 24 | //送信開始 |
| ryuna | 1:a47cb7834afe | 25 | sensor.putc(1); |
| ryuna | 1:a47cb7834afe | 26 | //送信空き割り込み設定 |
| ryuna | 1:a47cb7834afe | 27 | sensor.attach(&micon_rx,Serial::TxIrq); |
| ryuna | 0:ae8fbdc800ba | 28 | while(1) { |
| ryuna | 0:ae8fbdc800ba | 29 | myled = 1; |
| ryuna | 0:ae8fbdc800ba | 30 | wait(0.2); |
| ryuna | 0:ae8fbdc800ba | 31 | myled = 0; |
| ryuna | 0:ae8fbdc800ba | 32 | wait(0.2); |
| ryuna | 0:ae8fbdc800ba | 33 | } |
| ryuna | 0:ae8fbdc800ba | 34 | } |