Skip to content

Instantly share code, notes, and snippets.

@makersenses
Created April 24, 2021 13:38
Show Gist options
  • Save makersenses/0b98c0c2d4b993acfd0dc5bb37669759 to your computer and use it in GitHub Desktop.
Save makersenses/0b98c0c2d4b993acfd0dc5bb37669759 to your computer and use it in GitHub Desktop.
wifi_esp32_BH1750
#include "Senses_wifi_esp32.h"
#include <BH1750.h>
#include <Wire.h>
BH1750 lightMeter;
Senses_wifi_esp32 myiot;
const char *ssid = "your-wifi-network-name";
const char *passw = "your-wifi-password";
const char *userid = "your-senses-user-id";
const char *key = "your-device-key";
String response = "";
void setup() {
Serial.begin(115200);
Wire.begin();
lightMeter.begin();
response = myiot.connect(ssid, passw, userid, key);
Serial.println(response);
}
void loop() {
float lux = lightMeter.readLightLevel(); 0
Serial.print("Light: "); Serial.print(lux); Serial.println(" lx");
String response = myiot.send(1, lux);
Serial.println(response);
delay(5000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment