Hello kossigan1999
Are you sure you're receiving anything from your sensor?
Add a Serial.println in readSensor
A part of readSensor:
while (millis() - startTime <= TIMEOUT && byteCount < 11) {
if (mod.available()) {
response[byteCount++] = mod.read();
}
}
Serial.println("Bytes received: " + String(byteCount));
if (byteCount >= 5) {
return (int16_t)(response[3] << 8 | response[4]);
}
return 0;
}
A+
Cordialement,
jpbbricole