Galera preciso colocar meu arduino para comunicar com uma remota i/o da murr que trabalha em modbus tcp/ip mas estou tentando usar a biblioteca arduinomodbus mas nao estou conseguindo compilar!
alguem ja conseguiu fazer o arduino funcionar como master?
Já usou esta biblioteca ou outra e poderia me ajudar!
segue o exemplo que estou usando!
#include
#include
#include
#include
#include // ArduinoModbus depends on the ArduinoRS485 library
#include
ModbusTCPClient modbusTCPClient(EthernetClient);
IPAddress server(10, 0, 0, 1); // update with the IP Address of your Modbus server
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Modbus TCP Client Toggle");
}
void loop() {
if (!modbusTCPClient.connected()) {
// client not connected, start the Modbus TCP client
Serial.println("Attempting to connect to Modbus TCP server");
// write the value of 0x01, to the coil at address 0x00
if (!modbusTCPClient.coilWrite(0x00, 0x01)) {
Serial.print("Failed to write coil! ");
Serial.println(modbusTCPClient.lastError());
}
// wait for 1 second
delay(1000);
// write the value of 0x00, to the coil at address 0x00
if (!modbusTCPClient.coilWrite(0x00, 0x00)) {
Serial.print("Failed to write coil! ");
Serial.println(modbusTCPClient.lastError());
}
// wait for 1 second
delay(1000);
}
}
segue o erro apresentado:
exit status 1
request for member 'connected' in 'modbusTCPClient', which is of non-class type 'ModbusTCPClient(EthernetClient)'