Advertisement
Guest User

Untitled

a guest
May 26th, 2013
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. #include <XBee.h>
  2.  
  3. #define SLEEP 1000
  4. #define LED_SLEEP 100
  5. #define BOOT_SLEEP 2000
  6.  
  7. XBee xbee = XBee();
  8. uint8_t payload = 0;
  9. Tx16Request tx = Tx16Request(0x1874, &payload, sizeof(payload));
  10. int statusLed = 13;
  11.  
  12. void flashLed(int pin, int times, int wait) {
  13. for (int i = 0; i < times; i++) {
  14. digitalWrite(pin, HIGH);
  15. delay(wait);
  16. digitalWrite(pin, LOW);
  17. if (i + 1 < times) {
  18. delay(wait);
  19. }
  20. }
  21. }
  22.  
  23. void setup() {
  24. pinMode(statusLed, OUTPUT);
  25. Serial.begin(115200);
  26. xbee.setSerial(Serial);
  27. delay(BOOT_SLEEP);
  28. }
  29.  
  30. void loop() {
  31. xbee.send(tx);
  32. flashLed(statusLed, 1, LED_SLEEP);
  33. payload++;
  34. delay(SLEEP);
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement