Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SoftwareSerial.h>
- SoftwareSerial RS485Serial(2, 3); // RX, TX
- void setup() {
- pinMode(4, OUTPUT); // Control the DE/RE pin
- digitalWrite(4, LOW); // Set to receive mode
- RS485Serial.begin(9600);
- Serial.begin(9600);
- }
- void loop() {
- if (RS485Serial.available()) {
- String message = RS485Serial.readString();
- Serial.println("Received: " + message);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement