/** Test sending (and receiving) via wireless transmission * BLUETOOTH VERSION FOR EYEBOT * @author Thomas Braunl, May 2005 */ #include "eyebot.h" #include "string.h" int main() { BYTE myId; int err, key; char* hello = "Hello EyeBot!\n"; int hlen = strlen(hello); //BYTE mes[20]; /* message buffer */ LCDPutString("Wireless Eye2PC\n"); LCDPutString("---------------\n"); LCDMenu("Hel","AAA","Stp","END"); myId = OSMachineID(); if (myId==0) { LCDPutString("RadioLib not enabled!\n"); return 1; } else LCDPrintf("I am robot %d\n", myId); LCDPutString("Radio.."); err = RADIOInit(); if (err) { LCDPutString("Error Radio Init\n"); return 1; } else LCDPutString("Init\n"); do { key = KEYGet(); if (key == KEY1) { LCDPutString(hello); err = RADIOSend(0, hlen, (BYTE*) hello); /* send to Host PC */ if (err) { LCDPutString("Error Send\n"); return 1; } } if (key == KEY2) do { LCDPutString("A"); err = RADIOSend(0, 1, "A"); /* send to Host PC */ } while (!err && (KEYRead() != KEY3)); /* if (RADIOCheck()) //check whether message is waiting { RADIORecv(&fromId, &len, mes); // wait for next message LCDPrintf("Recv %d-%d: %3d\a\n", fromId, len, mes[0]); err = RADIOSend(nextId, 1, mes); if (err) { LCDPutString("Error Send\n"); return 1; } } */ } while (key != KEY4); LCDPutString("Term.."); RADIOTerm(); return 0; }