[{"data":1,"prerenderedAt":66},["ShallowReactive",2],{"example-page-esp32-weather":3},{"id":4,"info":5,"parts":6,"wired":17,"refs":18,"nets":19,"moreNets":60,"code":61},"esp32-weather","An ESP32-DevKitC runs an Arduino sketch (Arduino-ESP32 core, FreeRTOS on both Xtensa LX6 cores): the BME280 measures temperature, air pressure and humidity, the 0.96\" OLED (SSD1306) shows them, and every 2 s they go to the serial console. Both sit on the I²C bus (SDA GPIO21, SCL GPIO22) with the original Adafruit libraries. Set the sensor's environment in the inspector while it runs; change the sketch in the code editor (Firmware: arduino or zephyr in the part's parameters).",[7,10,13,15],[8,9],"resistor",2,[11,12],"bme280",1,[14,12],"esp32_devkitc",[16,12],"ssd1306",false,{"A1":14,"DS1":16,"U2":11,"R1":8,"R2":8},[20,30,43,52],{"name":21,"pins":22},"0",[23,26,28],[24,25],"A1","GND",[27,25],"DS1",[29,25],"U2",{"name":31,"pins":32},"3V3",[33,34,36,39,41],[24,31],[27,35],"VCC",[37,38],"R1","1",[40,38],"R2",[29,42],"VIN",{"name":44,"pins":45},"SCL",[46,48,49,51],[24,47],"GPIO22",[27,44],[37,50],"2",[29,44],{"name":53,"pins":54},"SDA",[55,57,58,59],[24,56],"GPIO21",[27,53],[40,50],[29,53],0,{"file":62,"lang":63,"text":64,"lines":65,"more":17},"sketch.ino","cpp","\u002F\u002F ESP32 weather station: a BME280 measures temperature, humidity and pressure, an SSD1306 OLED\n\u002F\u002F shows them; both on the I2C bus (SDA GPIO21, SCL GPIO22). Every 2 s also on the serial console.\n#include \u003CWire.h>\n#include \u003CAdafruit_GFX.h>\n#include \u003CAdafruit_SSD1306.h>\n#include \u003CAdafruit_BME280.h>\n\nAdafruit_SSD1306 oled(128, 64, &Wire, -1);\nAdafruit_BME280 bme;\n\nvoid setup() {\n  Serial.begin(115200);\n  Wire.begin(21, 22);\n  if (!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)) Serial.println(\"no OLED at 0x3C\");\n  if (!bme.begin(0x76)) Serial.println(\"no BME280 at 0x76\");\n  oled.setTextColor(SSD1306_WHITE);\n  Serial.println(\"ESP32 weather station\");\n}\n\nvoid loop() {\n  float t = bme.readTemperature(), h = bme.readHumidity(), p = bme.readPressure() \u002F 100.0f;\n  oled.clearDisplay();\n  oled.setTextSize(1);\n  oled.setCursor(0, 0);\n  oled.print(\"ESP32 weather\");\n  oled.setTextSize(2);\n  oled.setCursor(0, 16);\n  oled.printf(\"%.1f C\", t);\n  oled.setTextSize(1);\n  oled.setCursor(0, 40);\n  oled.printf(\"Humidity %.0f %%\", h);\n  oled.setCursor(0, 52);\n  oled.printf(\"%.1f hPa\", p);\n  oled.display();\n  Serial.printf(\"T %.1f C  H %.0f %%  P %.1f hPa\\n\", t, h, p);\n  delay(2000);\n}",37,1796304400974]