Control of mbed using OSC. Based on code from the Make Controller. Right now you can turn the onboard LEDs on/off and toggle 8 digital out pins. More I/O will be done in the future.
main.cpp@0:439354122597, 2010-03-17 (annotated)
- Committer:
- pehrhovey
- Date:
- Wed Mar 17 03:17:38 2010 +0000
- Revision:
- 0:439354122597
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pehrhovey | 0:439354122597 | 1 | |
pehrhovey | 0:439354122597 | 2 | /* |
pehrhovey | 0:439354122597 | 3 | * Pehr Hovey |
pehrhovey | 0:439354122597 | 4 | * mBed OSC |
pehrhovey | 0:439354122597 | 5 | * main.cpp |
pehrhovey | 0:439354122597 | 6 | * control mbed with OSC using mbed's ethernet port and UDP |
pehrhovey | 0:439354122597 | 7 | * |
pehrhovey | 0:439354122597 | 8 | */ |
pehrhovey | 0:439354122597 | 9 | |
pehrhovey | 0:439354122597 | 10 | #include "mbed.h" |
pehrhovey | 0:439354122597 | 11 | |
pehrhovey | 0:439354122597 | 12 | |
pehrhovey | 0:439354122597 | 13 | extern int osc_init(); |
pehrhovey | 0:439354122597 | 14 | extern void osc_poll(); |
pehrhovey | 0:439354122597 | 15 | |
pehrhovey | 0:439354122597 | 16 | int main() { |
pehrhovey | 0:439354122597 | 17 | |
pehrhovey | 0:439354122597 | 18 | osc_init(); //set everything up |
pehrhovey | 0:439354122597 | 19 | |
pehrhovey | 0:439354122597 | 20 | |
pehrhovey | 0:439354122597 | 21 | //Send a startup packet |
pehrhovey | 0:439354122597 | 22 | printf("mBed OSC Started...\r\n"); |
pehrhovey | 0:439354122597 | 23 | |
pehrhovey | 0:439354122597 | 24 | while(1) { |
pehrhovey | 0:439354122597 | 25 | //Poll OSC to get incoming UDP packets and handle them |
pehrhovey | 0:439354122597 | 26 | osc_poll(); |
pehrhovey | 0:439354122597 | 27 | |
pehrhovey | 0:439354122597 | 28 | //do other things... |
pehrhovey | 0:439354122597 | 29 | wait(0.1); //A little sleep to let Timeout work |
pehrhovey | 0:439354122597 | 30 | } |
pehrhovey | 0:439354122597 | 31 | } |