Welcome to EnviroDIY, a community for do-it-yourself environmental science and monitoring. EnviroDIY is part of WikiWatershed, an initiative of Stroud Water Research Center designed to help people advance knowledge and stewardship of fresh water.
New to EnviroDIY? Start here

Reply To: Calculated Variable Celsius to Fahrenheit DS18

Home Forums Mayfly Data Logger Calculated Variable Celsius to Fahrenheit DS18 Reply To: Calculated Variable Celsius to Fahrenheit DS18

#15134
Sara Damiano
Moderator

    In line 237 you don’t need the “new” or anything else with the calcTempF.

    Replace new CalcTempF(&ds18, "12345689-abcd-1234-ef00-1234567890ab"), with just CalcTempF,

    You’ve already created and named the variable, so you don’t need to re-create it, just reference it. Actually, since you’ve created all your variables with names, you should reference all of them that way instead of creating a second identical one for each of them. So in your variable array, you can replace almost all of the new ... with the names you gave the variables in the sensor blocks. The result will look more like the VariableArray in the data saving example: https://github.com/EnviroDIY/ModularSensors/blob/149bb59cdb34f7d54d26cd4a81b7e7a90eabced8/examples/data_saving/data_saving.ino#L318