Closed counters closed 4 years ago
Arduino DUE does not have SoftwareSerial.h . For normal library operation, insert a check on the hardware platform. ModbusRtu.h
#include <SoftwareSerial.h>
SoftwareSerial *softPort; //!< Pointer to SoftwareSerial class object
void begin(SoftwareSerial *sPort, long u32speed);
void begin(SoftwareSerial *sPort, long u32speed, uint8_t u8txenpin);
ModbusRtu.cpp
void MODBUS_RTU::begin(SoftwareSerial *sPort, long u32speed, uint8_t u8txenpin){ //pinMode(SerialTxControl, OUTPUT); this->u8txenpin=u8txenpin; softPort=sPort;
softPort->begin(u32speed);
if (u8txenpin > 1) // pin 0 & pin 1 are reserved for RX/TX
{
// return RS485 transceiver to transmit mode
pinMode(u8txenpin, OUTPUT);
digitalWrite(u8txenpin, LOW);
}
while(softPort->read() >= 0);
u8lastRec = u8BufferSize = 0;
u16InCnt = u16OutCnt = u16errCnt = 0;
}
And further in the text where there are challenges SoftwareSerial.h
The "SoftwareSerial" library is not compatible with Arduino Due. Please modify the library without "SoftwareSeries".