Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //transmitter
- #include <RS485_non_blocking.h>
- #include <SoftwareSerial.h>
- SoftwareSerial rsbus (2, 3); // receive pin, transmit pin
- const byte ENABLE_PIN = 4;
- size_t fWrite (const byte what)
- {
- return rsbus.write (what);
- }
- RS485 myChannel (NULL, NULL, fWrite, 0);
- void setup ()
- {
- rsbus.begin (9600);
- myChannel.begin ();
- } // end of setup
- const byte msg [] = "Hello world";
- void loop ()
- {
- digitalWrite (ENABLE_PIN, HIGH); // disable sending
- myChannel.sendMsg (msg, sizeof (msg));
- digitalWrite (ENABLE_PIN, LOW); // disable sending
- delay (1000);
- } // end of loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement