Hi ,
I am trying to interface HTU21D-F Temperature & Humidity Sensor with adafruit feather M0 Express using Adafruit HTU21DF Library but i am unable to get it working. The sensor works well with arduino uno using the same library. Can you tell what changes i need to do in order to get it working with feather m0 express.
Thanks,
shivam
Adafruit HTU21D-F Temperature & Humidity Sensor with Adafrui
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- tshivam07
- Posts: 2
- Joined: Thu Oct 21, 2021 7:45 am
- Franklin97355
- Posts: 23938
- Joined: Mon Apr 21, 2008 2:33 pm
Re: Adafruit HTU21D-F Temperature & Humidity Sensor with Ada
Just what are you trying to do with your code ( and can you post your code) ? If there are no hardware-specific statements it should work.
- tshivam07
- Posts: 2
- Joined: Thu Oct 21, 2021 7:45 am
Re: Adafruit HTU21D-F Temperature & Humidity Sensor with Ada
Hi please see the code below. I don't get any errors when i am uploading the code to FeatherM0 Express board. But i don't get the results on the serial monitor i.e. when i am connecting the sensor to Arduino Uno, i am getting the results in form of temperature and humidity readings in proper format whereas when i am connecting the sensor to feather m0 express board, the serial monitor remains blank.
Please see the code below that i am using.
Please see the code below that i am using.
Code: Select all
#include <Wire.h>
#include "Adafruit_HTU21DF.h"
// Connect Vin to 3-5VDC
// Connect GND to ground
// Connect SCL to I2C clock pin (A5 on UNO)
// Connect SDA to I2C data pin (A4 on UNO)
Adafruit_HTU21DF htu = Adafruit_HTU21DF();
void setup() {
Serial.begin(9600);
Serial.println("HTU21D-F test");
if (!htu.begin()) {
Serial.println("Couldn't find sensor!");
while (1);
}
}
void loop() {
float temp = htu.readTemperature();
float rel_hum = htu.readHumidity();
Serial.print("Temp: "); Serial.print(temp); Serial.print(" C");
Serial.print("\t\t");
Serial.print("Humidity: "); Serial.print(rel_hum); Serial.println(" \%");
delay(500);
}
Please be positive and constructive with your questions and comments.