Xiao esp32C6 and the DS18B20

I have the sensors, dozens of them in a bag (Digi had a sale a few years back). Both the waterproof ones and the little ones. I use them all the time with various little processors.

BUT I FOUND THE PROBLEM !!

After hours and hours of trying things, while I was typing in the question and describing the problem, I thought of something that I hadn’t tried, and absolutely none of the examples out there had in them. I tried it, and it worked.

I changed the code from this:

void setup() {
// Start the Serial Monitor
Serial.begin(115200);
// Start the DS18B20 sensor
sensors.begin();
}

to this:

void setup() {
// Start the Serial Monitor
Serial.begin(115200);
// Start the DS18B20 sensor
pinMode(oneWireBus, INPUT);
sensors.begin();
}

Yep, I had to let the device know what I was using the pin for. I have the pin (oneWireBus) defined as D7, not 7. None of the examples, tutorials, etc have this little jewel in them. That makes me wonder how many people actually do the things they spout off about on the web. It also make me wonder how many people try some of those things and just give up after trying for a couple of hours.

3 Likes