I have problem playing with DS18B20 temperature sensors > Copy / paste 'Multiple DS18B20 temperature sensors' example.
Problem is in this line of code:
temperature = ds18b20.getTemperature(ADDR(i))
Whenever program executes getTemperature() ZUNO resets. Resets are repeating in infinite loop and ZUNO flashes red LED 4 times.
Where is the problem? It took me half a day to figure out:
#define ADDR_SIZE 8
byte addresses[ADDR_SIZE * N_SENSOR];
Byte array of addresses is to short to store whatever ds18b20.findAllSensors(addresses) writes in. Looks like writing goes over the end and overwrites some compiled code.
What was my solution? I increased addresses[] length (for 5 bytes or more) and the problem is gone:
addresses[(ADDR_SIZE * MAX_TEMP_SENSORS) + 5]
Is there a bug in ZUNO_DS18B20.h library? Am I really the only one having this basic strange behaviour?
ZUNO2 rev.6
Bootloader version: 3.0.10
Arduino IDE 2.0.3
Two DS18B20 temp. sensors
Included + S2
ZUNO2 strange bahaviour using DS18B20
Re: ZUNO2 strange bahaviour using DS18B20
Hello.
It was like this:
And it should be like this:
No one seemed to have more than three sensors...
An error in the example.Is there a bug in ZUNO_DS18B20.h library? Am I really the only one having this basic strange behaviour?
It was like this:
Code: Select all
number_of_sensors = ds18b20.findAllSensors(addresses);
Code: Select all
number_of_sensors = ds18b20.findAllSensors(addresses, N_SENSOR);
Re: ZUNO2 strange bahaviour using DS18B20
True, you have 2 sensors, it is strange that you have problems.Two DS18B20 temp. sensors
Can you try with the change I mentioned?
Re: ZUNO2 strange bahaviour using DS18B20
Added 'N_SENSOR' solved my problem!
THX, @amatilda.
THX, @amatilda.