The way to measure the temperature by arduino uno & hdc1080

How could I measure the temperature by arduino uno, hdc1080, and breadboard? I want to know the code. I asked chatgpt that question, but I can't solve the problem. help me please!

I think I can measure the temperature, but I can't. the temperature is measured by 125 degree again & again.

#include <Wire.h>
#include "ClosedCube_HDC1080.h"

ClosedCube_HDC1080 hdc1080;

void setup()
{
Serial.begin(9600);
Serial.println("ClosedCube HDC1080 Arduino Test");

// Default settings:
// - Heater off
// - 14 bit Temperature and Humidity Measurement Resolutions
hdc1080.begin(0x40);

Serial.print("Manufacturer ID=0x");
Serial.println(hdc1080.readManufacturerId(), HEX); // 0x5449 ID of Texas Instruments
Serial.print("Device ID=0x");
Serial.println(hdc1080.readDeviceId(), HEX); // 0x1050 ID of the device

printSerialNumber();

}

void loop()
{
Serial.print("T=");
Serial.print(hdc1080.readTemperature());
Serial.print("C, RH=");
Serial.print(hdc1080.readHumidity());
Serial.println("%");
delay(3000);
}

void printSerialNumber() {
Serial.print("Device Serial Number=");
HDC1080_SerialNumber sernum = hdc1080.readSerialNumber();
char format[12];
sprintf(format, "%02X-%04X-%04X", sernum.serialFirst, sernum.serialMid, sernum.serialLast);
Serial.println(format);
}

I used this code,

and I used this circuit.

Hello, you can try the code here: Arduino Uno and HDC1080 humidity and temperature sensor - Arduino Learning

The purpose of the forum is to help people with project problems, not to write code or design projects.

If you want someone to design your project for you, ask a moderator to change your project to the category:
" About the Jobs and Paid Consultancy category"

By clicking on < code > in the toolbar, post your best attempt at writing code and let us know what happens to it.

Also post a schematic (even freehand) of your project.

Provide a link or the datasheet of the components used in your project.

I ran that code, but got the following error.

/Users/philip1029/Desktop/arduino/hdc1080demo_1/hdc1080demo_2.ino:4:20: error: redefinition of 'ClosedCube_HDC1080 hdc1080'
ClosedCube_HDC1080 hdc1080;
^~~~~~~
/Users/philip1029/Desktop/arduino/hdc1080demo_1/hdc1080demo_1.ino:22:20: note: 'ClosedCube_HDC1080 hdc1080' previously declared here
ClosedCube_HDC1080 hdc1080;
^~~~~~~
/Users/philip1029/Desktop/arduino/hdc1080demo_1/hdc1080demo_2.ino: In function 'void setup()':
/Users/philip1029/Desktop/arduino/hdc1080demo_1/hdc1080demo_2.ino:6:6: error: redefinition of 'void setup()'
void setup()
^~~~~
/Users/philip1029/Desktop/arduino/hdc1080demo_1/hdc1080demo_1.ino:24:6: note: 'void setup()' previously defined here
void setup()
^~~~~
/Users/philip1029/Desktop/arduino/hdc1080demo_1/hdc1080demo_2.ino: In function 'void loop()':
/Users/philip1029/Desktop/arduino/hdc1080demo_1/hdc1080demo_2.ino:25:6: error: redefinition of 'void loop()'
void loop()
^~~~
/Users/philip1029/Desktop/arduino/hdc1080demo_1/hdc1080demo_1.ino:43:6: note: 'void loop()' previously defined here
void loop()
^~~~
/Users/philip1029/Desktop/arduino/hdc1080demo_1/hdc1080demo_2.ino: In function 'void printSerialNumber()':
/Users/philip1029/Desktop/arduino/hdc1080demo_1/hdc1080demo_2.ino:35:6: error: redefinition of 'void printSerialNumber()'
void printSerialNumber() {
^~~~~~~~~~~~~~~~~
/Users/philip1029/Desktop/arduino/hdc1080demo_1/hdc1080demo_1.ino:53:6: note: 'void printSerialNumber()' previously defined here
void printSerialNumber() {
^~~~~~~~~~~~~~~~~

exit status 1

Compilation error: redefinition of 'ClosedCube_HDC1080 hdc1080'

Okay

do you get anything printed out from this?

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.