Hey everybody
My IDE isn't able to upload any code to the MKR WiFi 1010 I'm using. I'm also using a MKR485 shield attached to the Arduino.
Most of the time the IDE is stuck during upload, but sometimes it displays this error message:
Arduino: 1.8.13 (Windows 10), Board: "Arduino MKR WiFi 1010"
Sketch uses 12240 bytes (4%) of program storage space. Maximum is 262144 bytes.
Global variables use 2952 bytes (9%) of dynamic memory, leaving 29816 bytes for local variables. Maximum is 32768 bytes.
Forcing reset using 1200bps open/close on port COM4
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
PORTS {COM1, COM4, } / {COM1, COM4, } => {}
Uploading using selected port: COM4
C:\Users\lezai\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.7.0-arduino3/bossac.exe -i -d --port=COM4 -U true -i -e -w -v C:\Users\lezai\AppData\Local\Temp\arduino_build_811093/sketch_jan25a.ino.bin -R
An error occurred while uploading the sketch
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Here's the code I'm using. It's still a work in progress so it doesn't work 100% yet.
#include <ArduinoRS485.h>
#include <ArduinoModbus.h>
void setup()
{
Serial.begin(9600); //Setup Serial port
while (!Serial); //wait for serial port to connect
Serial.println("Modbus conductivity Sensor");
// start the Modbus RTU client, Works!
if (!ModbusRTUClient.begin(38400, SERIAL_8N1)) //Checks if Modbus RTU client started properly
{
Serial.println("Failed to start Modbus RTU Client! "); //returns message if Modbus RTU Client didn't start properly
while (1);
}
}
void loop()
{
float con = ModbusRTUClient.holdingRegisterRead(247, 504); //first value
Serial.println(con);
float con2 = ModbusRTUClient.holdingRegisterRead(247, 1003); //second value
Serial.println(con2);
// send a Holding register read request to (slave) id 247, for 2 registers (requestFrom(id, type, address, nb);)
if (0 == ModbusRTUClient.requestFrom(247, HOLDING_REGISTERS, 0x01002, 5))
{
Serial.print("Failed to read registers!"); //returns error code if read fails
Serial.println(ModbusRTUClient.lastError());
}
else
{
// If the request succeeds, the sensor sends the readings, that are
// stored in the holding registers. The read() method can be used to
// get the conductivity values
float conductivity2 = ModbusRTUClient.read();
Serial.println(conductivity2);
}
delay(5000);
}
Hope you can help me!!!