Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #define INCLUDE_ASYNC_ACK true
  2. #include <PJON.h>
  3.  
  4. // <Strategy name> bus(selected device id)
  5. PJON<ThroughSerial> bus(11);
  6.  
  7. long counter=0;
  8.  
  9. void setup() {
  10. pinModeFast(13, OUTPUT);
  11. digitalWriteFast(13, LOW); // Initialize LED 13 to be off
  12. bus.begin();
  13. Serial.begin(9600);
  14. bus.strategy.set_serial(&Serial); // Pass the Serial object you want to use for communication
  15. bus.strategy.set_enable_RS485_pin(2);
  16. //bus.send_repeatedly(44, "A", 1, 5000000); // Send B to device 44 every second
  17.  
  18. }
  19.  
  20. void loop() {
  21. bus.update();
  22.  
  23. if (counter==50000){
  24. digitalWrite(13, HIGH);
  25. delay(30);
  26. digitalWrite(13, LOW);
  27. bus.send(44, "B", 1);
  28. counter=0;
  29. } else {
  30. counter++;
  31. }
  32. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement