2020-10-21 at 3:36 PM #14703James_NZParticipant
I have a reasonably basic question about the modular sensors code. We are trialing new arduino type sensors that are not included in the modular sensors library. What is the best way to make these work with the modular sensors logger code? At the moment I am creating ‘calculated’ variables, but I’m hoping there is a tidier way to do this. Should I be developing my c++ skills so I can write .cpp and .h files that are called into the modular sensors script?
Another very basic question. I am trying to use a ds18b20 temperature sensor to correct a simple conductivity sensor. Given that the ds18b20 is already a variable in my modular sensors script (based on default example script ‘simple logging.ino’), how do I call that value into my ‘calculateconductivity’ function. I can do this in the arduino IDE using something like:12sensors.requestTemperatures();temp = sensors.<code>getTempCByIndex(0);
However, I can’t seem to find this code in the modular sensors script, and when I run a second ‘sensors’ object it doesn’t seem to work. Any help would be much appreciated.
2020-10-23 at 8:37 AM #14706Sara DamianoModerator
The “best” way to work with ModularSensors would be to write the c/h files and submit them as a pull request. 🙂 But if the calculated variable is working, then feel free to keep using it that way for yourself.
If you define your variable for the DS18 temperature as something like
Variable* ds18Temp = new MaximDS18_Temp(&ds18, "12345678-abcd-1234-ef00-1234567890ab);
then in your calculation equation you would use something like
float ds18TempVal = ds18Temp ->getValue();
The “baro_rho_correction” example is probably the best one to look at to see something similar in action: https://github.com/EnviroDIY/ModularSensors/blob/master/examples/baro_rho_correction/baro_rho_correction.ino
2020-10-25 at 4:46 PM #14712
- You must be logged in to reply to this topic.