52 lines
957 B
Arduino
Raw Normal View History

2021-01-29 12:31:58 +01:00
//
// FILE: AM2322_plotter.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo sketch for AM2322 I2C humidity & temperature sensor
//
2022-01-06 14:05:38 +01:00
// AM232X PIN layout AM2315 COLOR
// ============================================
// bottom view DESCRIPTION COLOR
2021-01-29 12:31:58 +01:00
// +---+
2022-01-06 14:05:38 +01:00
// |o | VDD RED
// |o | SDA YELLOW
// |o | GND BLACK
// |o | SCL GREY
2021-01-29 12:31:58 +01:00
// +---+
//
// do not forget pull up resistors between SDA, SCL and VDD.
2021-02-03 17:20:20 +01:00
2022-01-06 14:05:38 +01:00
#include "AM232X.h"
2021-01-29 12:31:58 +01:00
AM232X AM2322;
2021-02-03 17:20:20 +01:00
2021-01-29 12:31:58 +01:00
void setup()
{
Serial.begin(115200);
2021-02-03 17:20:20 +01:00
if (! AM2322.begin() )
{
Serial.println("Sensor not found");
while (1);
}
2022-01-06 14:05:38 +01:00
AM2322.wakeUp();
delay(2000);
2021-02-03 17:20:20 +01:00
2021-01-29 12:31:58 +01:00
Serial.println("Humidity(%),\tTemperature(C)");
}
2021-02-03 17:20:20 +01:00
2021-01-29 12:31:58 +01:00
void loop()
{
AM2322.read();
Serial.print(AM2322.getHumidity(), 1);
Serial.print(",\t");
Serial.println(AM2322.getTemperature(), 1);
delay(100);
}
2021-12-11 19:15:19 +01:00
2021-01-29 12:31:58 +01:00
// -- END OF FILE --