andresarmento / modbus-arduino

A library that allows your Arduino to communicate via Modbus protocol, acting as a slave (master in development). Supports serial (RS-232, RS-485) and IP via Ethernet (Modbus IP).
BSD 3-Clause "New" or "Revised" License
453 stars 267 forks source link

mb.config(mac, ip) mb does not name type #40

Open esfx14 opened 5 years ago

esfx14 commented 5 years ago

Board: Adafruit ESP Feather with Ethernet FeatherWing Upload Speed: 115200 Flash Frequency: 80 MHz

I would like to use this ModbusIP thing and tried first to do it like the example, but there is this error message, that mb does not name type.

include

include

include

include

include

const int SWITCH_ISTS = 100; ModbusIP mb(); byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; byte ip[] = {0,0,0,0}; mb.config (mac,ip);

void setup() { // put your setup code here, to run once:

}

void loop() { // put your main code here, to run repeatedly:

}

sketch_jan17c:12:1: error: 'mb' does not name a type mb.config (mac,ip); ^ exit status 1 'mb' does not name a type

ebot1234 commented 5 years ago

First take away the parenthesis from in front of the mb name for ModbusIP. Also use #include "Modbus.h" and #include "ModbusIP.h" instead of <> . Arduino doesn't like that and the error should go away.