Sorry that this is so specific, but I'm wondering if anyone can help me. I've got DS18B20 sensors and am able to read them both using various arduino code available on the web, however when I migrate that code into my current code I get an error saying that 'sensor' cannot be defined. I took this to mean that either my code had errors or that my library has issues.
I've checked and checked the code, I've downloaded fresh copies of the DallasTemperature library and installed it, but cannot seem to resolve this error.
Would anyone mind taking a look and pointing out to me my mistake which is no doubt extremely obvious - I just can't see it! The rest of the code works fine.
Code attached. Sensor addresses and API key omitted.
Thanks in advance
Re: General software help with DS18B20 Sensor
Either you have a typo in your question, or the answer is there in front of your eyes. There is no variable "sensor" in your sketch, but there is "sensors". I think you need to copy and paste the exact error message into a post so that we can see what the real problem is.
Ignoring that and trying to compile, in your getTemp() function, you have an undefined variable "ds". But you are not calling that function anyway, so it's redundant. I commented out the whole function. If you do want it in the future, you need to go back to the source where you lifted that code from and find what that should be.
I don't know what "char foo; //without a simple variable declaration, use of #ifdef at the top of your code raises an error!" is doing - it's totally redundant too. I commented that out also.
With those changes made, it compiles for me. But I don't think I have your hardware, so I can go no further.