Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Adafruit_BME280.h>
- Adafruit_BME280 bme; // I2C
- const byte lightPin = 34;
- int lightReading;
- void setup() {
- Serial.begin(9600);
- if (!bme.begin(0x76)) { //other potential address for BME280 could be 0x77
- Serial.println("Could not find BME280, check wiring!");
- while (1);
- }
- }
- void loop() {
- // put your main code here, to run repeatedly:
- Serial.print("Temperature = ");
- Serial.print(bme.readTemperature());
- Serial.println(" °C");
- Serial.print("Pressure = ");
- Serial.print(bme.readPressure() / 100.0F);
- Serial.println(" hPa");
- Serial.print("Humidity = ");
- Serial.print(bme.readHumidity());
- Serial.println(" %");
- Serial.println();
- lightReading = analogRead(lightPin); //0-4095 12bit -- esp8266 10bit 0-1023 -- arduino 8bit 0-254
- Serial.print("Light reading = ");
- Serial.println(lightReading);
- Serial.println();
- delay(3000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement