Bonjour à tous ,
Je suis débutant, j'ai un petit programme avec le capteur d'humidité et temperature affiché sur un lcd.
Est que je peux charger le programme sur un Attiny84 et l'exploiter sur un montage independant?
Merci d'avance pour vos reponses.
#include <LiquidCrystal.h>
#include "DHT.h"
#define DHTPIN 2
#define DHTTYPE DHT11
LiquidCrystal lcd(7, 8, 9, 10, 11, 12); // I2C address 0x3F, 16 column and 2 rows
DHT dht(DHTPIN, DHTTYPE);
void setup()
{
dht.begin(); // initialize the sensor
lcd.begin(16, 2); // initialize the lcd
}
void loop()
{
delay(2000); // wait a few seconds between measurements
float humi = dht.readHumidity(); // read humidity
float tempC = dht.readTemperature(); // read temperature
lcd.clear();
// check if any reads failed
if (isnan(humi) || isnan(tempC)) {
lcd.setCursor(0, 0);
lcd.print("Failed");
} else {
lcd.setCursor(0, 0); // start to print at the first row
lcd.print("Temp : ");
lcd.print(tempC); // print the temperature
lcd.print((char)223); // print ° character
lcd.print("C");
lcd.setCursor(0, 1); // start to print at the second row
lcd.print("Hydro: ");
lcd.print(humi); // print the humidity
lcd.print("%");
}
}