We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#include <ModbusSlave.h> #include <SoftwareSerial.h> SoftwareSerial RS485Serial(10, 11); // RX, TX
Modbus slave(RS485Serial, 1, 2);
int led = 12;
int dl_ro = 2;
void setup() {
pinMode(dl_ro, OUTPUT); pinMode(led, OUTPUT); slave.cbVector[CB_WRITE_COILS] = writeDigitalOut; RS485Serial.begin(9600); slave.begin(9600);
}
void loop() { slave.poll(); }
uint8_t writeDigitalOut(uint8_t fc, uint16_t address, uint16_t length) { Serial.print("FC=05: "); Serial.println(fc); Serial.println(address); Serial.println(length);
if (address == led) { digitalWrite(12, slave.readCoilFromBuffer(0)); }
return STATUS_OK;
The text was updated successfully, but these errors were encountered:
use arduino?
Sorry, something went wrong.
No branches or pull requests
#include <ModbusSlave.h>
#include <SoftwareSerial.h>
SoftwareSerial RS485Serial(10, 11); // RX, TX
Modbus slave(RS485Serial, 1, 2);
int led = 12;
int dl_ro = 2;
void setup() {
}
void loop() {
slave.poll();
}
uint8_t writeDigitalOut(uint8_t fc, uint16_t address, uint16_t length) {
Serial.print("FC=05: ");
Serial.println(fc);
Serial.println(address);
Serial.println(length);
if (address == led) {
digitalWrite(12, slave.readCoilFromBuffer(0));
}
}
The text was updated successfully, but these errors were encountered: