Answer the question
In order to leave comments, you need to log in
Arduino sketch, with different sensor addresses for each piece of iron. How to develop for multiple devices at the same time?
Arduino sketch, DS18B20 addresses are hardcoded in the code, there are several such pieces of iron.
Accordingly, each has its own addresses.
It would be so convenient to conduct development in one place, so that you would not have to change the addresses of the sensors before each upload.
There is an option for each piece of iron to conduct a separate project. But then, instead of the addresses of the sensors, you will have to copy-paste the code, which is also not convenient.
Answer the question
In order to leave comments, you need to log in
1. Get rid of hardcoded addresses. This is not always possible, but here it is more likely than not. DS18B20 can communicate its address (SearchRom / ReadRom commands). Let the controller read after loading the addresses of all sensors. The code will be generic.
2. Transfer the constants to EEPROM, flash once, do not overwrite when changing the EEPROM code. In AVR, the EESAVE fuse is responsible for this.
make the addresses constants, at the beginning of the code, make several declaration blocks for these constants for different devices, comment out and uncomment them before flashing a specific device...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question