Alex Louden
/
XBee_write
main.cpp@0:74b4b9fc9480, 2010-06-04 (annotated)
- Committer:
- alex89
- Date:
- Fri Jun 04 10:23:46 2010 +0000
- Revision:
- 0:74b4b9fc9480
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
alex89 | 0:74b4b9fc9480 | 1 | #include "main.h" |
alex89 | 0:74b4b9fc9480 | 2 | |
alex89 | 0:74b4b9fc9480 | 3 | Serial xbee1(p9, p10); |
alex89 | 0:74b4b9fc9480 | 4 | DigitalOut rst1(p11); |
alex89 | 0:74b4b9fc9480 | 5 | |
alex89 | 0:74b4b9fc9480 | 6 | DigitalOut myled(LED1); |
alex89 | 0:74b4b9fc9480 | 7 | DigitalOut myled2(LED2); |
alex89 | 0:74b4b9fc9480 | 8 | |
alex89 | 0:74b4b9fc9480 | 9 | int main() { |
alex89 | 0:74b4b9fc9480 | 10 | rst1 = 0; //Set reset pin to 0 |
alex89 | 0:74b4b9fc9480 | 11 | myled = 0; |
alex89 | 0:74b4b9fc9480 | 12 | myled2= 0; |
alex89 | 0:74b4b9fc9480 | 13 | wait_ms(1); |
alex89 | 0:74b4b9fc9480 | 14 | rst1 = 1; //Set reset pin to 1 |
alex89 | 0:74b4b9fc9480 | 15 | wait_ms(1); |
alex89 | 0:74b4b9fc9480 | 16 | |
alex89 | 0:74b4b9fc9480 | 17 | while (1) { |
alex89 | 0:74b4b9fc9480 | 18 | int a = getKeyNum(); |
alex89 | 0:74b4b9fc9480 | 19 | |
alex89 | 0:74b4b9fc9480 | 20 | if(a!=-1){ |
alex89 | 0:74b4b9fc9480 | 21 | myled2 = 1; |
alex89 | 0:74b4b9fc9480 | 22 | xbee1.putc(a); //XBee write |
alex89 | 0:74b4b9fc9480 | 23 | myled2 = 0; |
alex89 | 0:74b4b9fc9480 | 24 | } |
alex89 | 0:74b4b9fc9480 | 25 | } |
alex89 | 0:74b4b9fc9480 | 26 | } |