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.
main.cpp@0:dd5518967e8a, 2016-02-20 (annotated)
- Committer:
- Perijah
- Date:
- Sat Feb 20 11:47:19 2016 +0000
- Revision:
- 0:dd5518967e8a
Basic XBEE transmitter with application board
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Perijah | 0:dd5518967e8a | 1 | #include "mbed.h" |
| Perijah | 0:dd5518967e8a | 2 | |
| Perijah | 0:dd5518967e8a | 3 | Serial xbee(p9,p10); |
| Perijah | 0:dd5518967e8a | 4 | DigitalIn up(p15); //pin 15 is connected to the joystick on the application board |
| Perijah | 0:dd5518967e8a | 5 | DigitalIn down(p12); //pin 12 is connected to the joystick on the application board |
| Perijah | 0:dd5518967e8a | 6 | DigitalOut LED(LED1); //test led to check if the joystick is working |
| Perijah | 0:dd5518967e8a | 7 | |
| Perijah | 0:dd5518967e8a | 8 | int main() { |
| Perijah | 0:dd5518967e8a | 9 | xbee.baud(57600); |
| Perijah | 0:dd5518967e8a | 10 | while(1) { |
| Perijah | 0:dd5518967e8a | 11 | wait_ms(100); //to reduce buffer fill. Can be increased at the expense of less sensitive buttons |
| Perijah | 0:dd5518967e8a | 12 | if(up){ //check the direction of the joystick |
| Perijah | 0:dd5518967e8a | 13 | xbee.putc('u'); //send a character |
| Perijah | 0:dd5518967e8a | 14 | LED = 1; |
| Perijah | 0:dd5518967e8a | 15 | } |
| Perijah | 0:dd5518967e8a | 16 | if(down){ |
| Perijah | 0:dd5518967e8a | 17 | xbee.putc('d'); |
| Perijah | 0:dd5518967e8a | 18 | } |
| Perijah | 0:dd5518967e8a | 19 | |
| Perijah | 0:dd5518967e8a | 20 | } |
| Perijah | 0:dd5518967e8a | 21 | } |