Advertisement
zykes

Untitled

May 15th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <Arduino.h>
  2. #include <SPI.h>
  3.  
  4. #define TS_RESPONSE_TIME_OUT 200000
  5. #define TS_COLLISION_DELAY 3000
  6.  
  7. #define PJON_INCLUDE_TS true
  8. //#define PJON_INCLUDE_ETHERNET false
  9. #include <PJON.h>
  10.  
  11. // <Strategy name> bus(selected device id)
  12. PJON<ThroughSerial> bus(2);
  13.  
  14.  
  15. void setup() {
  16. pinMode(13, OUTPUT);
  17. bus.begin();
  18. Serial.begin(9600);
  19.  
  20. bus.strategy.set_serial(&Serial); // Pass the Serial object you want to use for communication
  21.  
  22. // Uncomment this if you use independant pins for rx / tx enable
  23. // bus.strategy.set_rx_RS485_pin(10);
  24. // bus.strategy.set_tx_RS485_pin(11);
  25.  
  26. // Use this if you use the same rx / tx pin
  27. bus.strategy.set_tx_RS485_pin(10);
  28.  
  29. //bus.send_repeatedly(1, "B", 1, 1000000);
  30. bus.send(1, "B", 1);
  31. }
  32.  
  33. void loop() {
  34. bus.update();
  35. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement