GithubHelp home page GithubHelp logo

Comments (4)

winkj avatar winkj commented on June 28, 2024

on a cursory check, I believe you didn't initialize the SHT library on Wire1. Could you change the call of sht.init() to sht.init(Wire1) and try again?

from arduino-sht.

TheLennyLeonard avatar TheLennyLeonard commented on June 28, 2024

thanks for fast reply...still getting the same message: Error in readSample() as you can see in my code.

from arduino-sht.

winkj avatar winkj commented on June 28, 2024

could you print the complete output? sht.init() should fail if the sensor is not detected ("init(): failed"), before readSample(). It should have either printed an error before (defaulting to Wire) or after the change to use Wire1, unless the Pi pico platform is working differently than other Arduinos.

As a further test, running I2CScanner helps: https://playground.arduino.cc/Main/I2cScanner/. This should detect a sensor responding on the SHT40's I2C address 0x44. This should help narrow down the root cause

from arduino-sht.

TheLennyLeonard avatar TheLennyLeonard commented on June 28, 2024

yeah, I was getting init(): failed responses...so I tried the I2C scanner and even the scanner cant find it...
I am afraid that because it is a pico not arduino...it will never gonna work. Tried to change pins on pico, so I can use Wire instead of Wire1.

here is the code:
`#include <Wire.h>

const byte PICO_I2C_ADDRESS = 0x44;
const byte PICO_HUMIDITY_PRECISION = 0xFD; // high precission
const byte PICO_I2C_SDA = 12;
const byte PICO_I2C_SCL = 13;

void setup()
{
pinMode(14,INPUT);
pinMode(15,INPUT);
Wire.setSDA(PICO_I2C_SDA);
Wire.setSCL(PICO_I2C_SCL);
Wire.begin();

Serial.begin(9600);
while (!Serial); // Leonardo: wait for serial monitor
Serial.println("\nI2C Scanner");
}

void loop()
{
byte error, address;
int nDevices;

Serial.println("Scanning...");

nDevices = 0;
for(address = 1; address < 127; address++ )
{
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
Wire.beginTransmission(address);
error = Wire.endTransmission();

if (error == 0)
{
  Serial.print("I2C device found at address 0x");
  if (address<16)
    Serial.print("0");
  Serial.print(address,HEX);
  Serial.println("  !");

  nDevices++;
}
else if (error==4)
{
  Serial.print("Unknown error at address 0x");
  if (address<16)
    Serial.print("0");
  Serial.println(address,HEX);
}    

}
if (nDevices == 0)
Serial.println("No I2C devices found\n");
else
Serial.println("done\n");

delay(5000); // wait 5 seconds for next scan
}
`
getting No I2C devices found...

from arduino-sht.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.