[{"data":1,"prerenderedAt":66},["ShallowReactive",2],{"example-page-uno-climate":3},{"id":4,"info":5,"parts":6,"wired":16,"refs":17,"nets":18,"moreNets":60,"code":61},"uno-climate","The DHT22 on D2 measures temperature and humidity (one-wire protocol, Adafruit DHT library). The 16×2 text LCD with I²C adapter (PCF8574, 0x27) shows them with two custom characters (thermometer, droplet). After power-on the library waits 1 s before it initializes the LCD; until then the LCD shows the typical blocks in line 1. Change temperature and humidity in the inspector, even while the simulation runs.",[7,10,12,14],[8,9],"arduino_uno",1,[11,9],"dht22",[13,9],"lcd_i2c",[15,9],"vdc",false,{"A1":8,"DS1":13,"U2":11,"V1":15},[19,32,41,48,54],{"name":20,"pins":21},"0",[22,25,27,29],[23,24],"A1","GND",[26,24],"DS1",[28,24],"U2",[30,31],"V1","−",{"name":33,"pins":34},"5V",[35,36,38,39],[23,33],[26,37],"VCC",[28,37],[30,40],"+",{"name":42,"pins":43},"DHT",[44,46],[23,45],"D2",[28,47],"DATA",{"name":49,"pins":50},"SCL",[51,53],[23,52],"A5\u002FSCL",[26,49],{"name":55,"pins":56},"SDA",[57,59],[23,58],"A4\u002FSDA",[26,55],0,{"file":62,"lang":63,"text":64,"lines":65,"more":16},"sketch.ino","cpp","\u002F\u002F Room climate display: the DHT22 on D2 measures, the 16×2 LCD with I²C adapter (0x27, A4\u002FA5) displays\n#include \u003CWire.h>\n#include \u003CLiquidCrystal_I2C.h>\n#include \u003CDHT.h>\n\nLiquidCrystal_I2C lcd(0x27, 16, 2);\nDHT dht(2, DHT22);\nbyte thermo[8] = { 0b00100, 0b01010, 0b01010, 0b01110, 0b01110, 0b11111, 0b11111, 0b01110 };   \u002F\u002F custom character (CGRAM)\nbyte drop[8]   = { 0b00100, 0b00100, 0b01010, 0b01010, 0b10001, 0b10001, 0b01110, 0b00000 };\n\nvoid setup() {\n  Serial.begin(115200);\n  lcd.init();                 \u002F\u002F waits 1 s after power-on (library)\n  lcd.backlight();\n  lcd.createChar(0, thermo);\n  lcd.createChar(1, drop);\n  dht.begin();\n}\n\nvoid loop() {\n  float t = dht.readTemperature(), h = dht.readHumidity();\n  if (isnan(t) || isnan(h)) { lcd.clear(); lcd.print(F(\"Sensor error\")); delay(2000); return; }\n  lcd.setCursor(0, 0); lcd.write(0); lcd.print(F(\" Temp: \")); lcd.print(t, 1); lcd.print((char)223); lcd.print(F(\"C  \"));\n  lcd.setCursor(0, 1); lcd.write(1); lcd.print(F(\" Humidity: \")); lcd.print(h, 0); lcd.print(F(\" %  \"));\n  Serial.print(t, 1); Serial.print(F(\" C  \")); Serial.print(h, 1); Serial.println(F(\" %\"));\n  delay(2000);                \u002F\u002F the DHT22 measures at most every 2 s\n}",27,1796304409765]