#include const int GPIOCoil = 0; #define MySerial Serial // define serial port used, Serial most of the time, or Serial1, Serial2 ... if available bool coils[10]; int pinToRead = 2; ModbusSerial mb (MySerial, 1); void setup() { MySerial.begin (9600, MB_PARITY_NONE); // prefer this line in accordance with the modbus standard. while (! MySerial) ; mb.config (9600); mb.addIsts(0); } void loop() { mb.setIsts(0, digitalRead(pinToRead)); mb.task(); // int r = Serial.read(); // if (r >= 0){ // Serial.write(r); // Serial.write(r); // } }