[{"data":1,"prerenderedAt":73},["ShallowReactive",2],{"example-page-uno-weather":3},{"id":4,"info":5,"parts":6,"wired":19,"refs":20,"nets":21,"moreNets":67,"code":68},"uno-weather","The BME280 measures temperature, air pressure and humidity, and the 0.96\" OLED (SSD1306) shows the values. Both sit on the Uno's I²C bus (A4 = SDA, A5 = SCL) and use the original Adafruit libraries. You can set the sensor's environment in the inspector, even while the simulation runs; the OLED image appears in the live window.",[7,10,13,15,17],[8,9],"resistor",2,[11,12],"arduino_uno",1,[14,12],"bme280",[16,12],"ssd1306",[18,12],"vdc",false,{"A1":11,"DS1":16,"U2":14,"V1":18,"R1":8,"R2":8},[22,35,50,59],{"name":23,"pins":24},"0",[25,28,30,32],[26,27],"A1","GND",[29,27],"DS1",[31,27],"U2",[33,34],"V1","−",{"name":36,"pins":37},"5V",[38,39,41,44,46,48],[26,36],[29,40],"VCC",[42,43],"R1","1",[45,43],"R2",[31,47],"VIN",[33,49],"+",{"name":51,"pins":52},"SCL",[53,55,56,58],[26,54],"A5\u002FSCL",[29,51],[42,57],"2",[31,51],{"name":60,"pins":61},"SDA",[62,64,65,66],[26,63],"A4\u002FSDA",[29,60],[45,57],[31,60],0,{"file":69,"lang":70,"text":71,"lines":72,"more":19},"sketch.ino","cpp","\u002F\u002F Weather station: the BME280 (0x76) measures, the SSD1306 OLED (0x3C) displays, both on the I²C bus (A4\u002FA5)\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  if (!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)) Serial.println(F(\"OLED missing\"));\n  if (!bme.begin(0x76)) Serial.println(F(\"BME280 missing\"));\n  oled.setTextColor(SSD1306_WHITE);\n}\n\nvoid loop() {\n  float t = bme.readTemperature(), p = bme.readPressure() \u002F 100.0, h = bme.readHumidity();\n  oled.clearDisplay();\n  oled.setTextSize(1); oled.setCursor(0, 0); oled.print(F(\"Weather station\"));\n  oled.setTextSize(2); oled.setCursor(0, 16); oled.print(t, 1); oled.print((char)247); oled.print('C');\n  oled.setTextSize(1); oled.setCursor(0, 40); oled.print(p, 1); oled.print(F(\" hPa\"));\n  oled.setCursor(0, 52); oled.print(h, 0); oled.print(F(\" % rel. humidity\"));\n  oled.display();\n  Serial.print(t, 2); Serial.print(F(\" C  \")); Serial.print(p, 2); Serial.print(F(\" hPa  \")); Serial.print(h, 1); Serial.println(F(\" %\"));\n  delay(500);\n}",27,1796304400848]