Replies: 1 comment 2 replies
-
hello, I hope you answer...did you find a solution to deal with that error? Thank you |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
first of all, thank you for this decent work.
i am porting my wall therostat from arduino mega to pico, but got issues with the SHT31 temperature/humidity sensor.
the sensor is found - sht.init() ends with success
but i get no readings - sht.readSample() is failing
the code and the sht31 sensor is working fine on arduino mega.
what am i missing? is it related to 5v on the arduino vs 3.3v on the pico or to this project?
the SHT31 is connected to
GP8 --> PIN 11 on the Pico
GP9 --> PIN 12 on the Pico
`
#include <Wire.h>
#include "SHTSensor.h"
SHTSensor sht(SHTSensor::SHT3X);
float actualTemperature = 99.9;
float actualHumidity = 99.9;
void setup() {
pinMode(8,INPUT);
pinMode(9,INPUT);
Wire.setSDA(8);
Wire.setSCL(9);
Wire.begin(0x44);
Serial.begin(115200);
while (!Serial)
delay(10);
if (sht.init()) {
Serial.print("init(): success\n");
} else {
Serial.print("init(): failed\n");
}
sht.setAccuracy(SHTSensor::SHT_ACCURACY_MEDIUM); // only supported by SHT3x
}
void loop() {
if (sht.readSample()) {
actualHumidity = sht.getHumidity();
Serial.print(actualHumidity, 2);
Serial.print("\n");
Serial.print(" T: ");
actualTemperature = sht.getTemperature();
Serial.print(actualTemperature, 2);
Serial.print("\n");
Serial.print("Reading SHT30 Data...OK\n");
} else {
Serial.print("Error in readSample()\n");
}
delay(1000);
}
`
Beta Was this translation helpful? Give feedback.
All reactions