I am failing to read a DS18B20 with a RaspberryPi Pico programmed with Arduino.
I found several examples using MicroPython, however I want to do it with Arduino using the 'Raspberry Pi Pico/RP2040' plugin by Earle F. Philhower.
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 14
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
void setup()
{
Serial.begin(115200);
}
void loop()
{
DS18B20.requestTemperatures();
float temp = DS18B20.getTempCByIndex(0);
Serial.print("Temperature: ");
Serial.println(temp);
delay(2000);
}
The code compiles, but leaves a warning
#warning "OneWire. Fallback mode. Using API calls for pinMode, digitalRead and digitalWrite. Operation of this library is not guaranteed on this architecture."
On the pico nothing works. Since not even the virtual com port appears, I assume the code fails before starting the loop.
I have tried different ports and also different versions of the code. Nothing works. Can anybody provide an example?