top of page
Sensorflow
K6a4aIRll5uIFCyEE
Product Dashboard
Product Name
Sensorflow GY302
Product Type
Hardware
Product ID
2uV1H1D6SGApKzKZ
Product Info
Heading 5
Properties/ Schema
Check
Product Firmware
Your content has been submitted
An error occurred. Try again later
Production
Device Name
User ID
Lastseen
Sensorflow GY302
2uV1H1D6SGApKzKZ
Sensorflow GY302
2uV1H1D6SGApKzKZ
Sensorflow GY302
2uV1H1D6SGApKzKZ
Sensorflow GY302
2uV1H1D6SGApKzKZ
Sensorflow GY302
2uV1H1D6SGApKzKZ
Sensorflow GY302
2uV1H1D6SGApKzKZ
Sensorflow GY302
2uV1H1D6SGApKzKZ
Sensorflow GY302
2uV1H1D6SGApKzKZ
Sensorflow GY302
2uV1H1D6SGApKzKZ
Sensorflow GY302
2uV1H1D6SGApKzKZ
Sensorflow GY302
2uV1H1D6SGApKzKZ
Sensorflow GY302
2uV1H1D6SGApKzKZ
Sensorflow GY302
2uV1H1D6SGApKzKZ
Sensorflow GY302
2uV1H1D6SGApKzKZ
#include
#include "BluetoothSerial.h"
#include
#include
#include
#include
BluetoothSerial SerialBT;
Preferences preferences;
BH1750 lightMeter;
LiquidCrystal_I2C lcd(0x27, 16, 2); // LCD address is 0x27
String NAME = "
";
String header;
String apikey;
String userid;
String deviceid;
String ssid;
String pass;
String lightvalue = "";
int restartcpount = 0;
HYPERWISOR_IOT Hyperwisorsensor;
int E_delay;
char buffer[10];
#define buzz 2
void setup() {
Serial.begin(115200);
delay(500);
Wire.begin();
lightMeter.begin();
pinMode(buzz, OUTPUT);
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Sensorflow");
lcd.setCursor(0, 1);
lcd.print("Light Sensor");
delay(3000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("--Powered by");
lcd.setCursor(0, 1);
lcd.print("NIKOLAINDUSTRY");
delay(3000);
Serial.println();
delay(500);
preferences.begin("my-app", false);
delay(500);
apikey = preferences.getString("apikey");
userid = preferences.getString("userid");
deviceid = preferences.getString("deviceid");
ssid = preferences.getString("ssid");
pass = preferences.getString("pass");
Hyperwisorsensor.init(apikey);
delay(500);
WiFi.disconnect();
delay(50);
Serial.println("connecting...");
WiFi.setHostname(NAME.c_str());
WiFi.begin(ssid.c_str(), pass.c_str());
delay(240000);
Serial.println("connected to");
Serial.println(ssid);
Serial.println(pass);
Serial.println(WiFi.localIP());
digitalWrite(buzz, HIGH);
delay(2000);
digitalWrite(buzz, LOW);
lcd.clear();
delay(100);
}
void loop() {
if ((WiFi.status() == WL_CONNECTED)) {
Serial.println("Connected");
getsensorvalue();
String mysensordata = ("&LUX=" + String(lightvalue));
String jsonobj = Hyperwisorsensor.sendData(mysensordata);
String response = Hyperwisorsensor.get_schema();
String delayvalue = Hyperwisorsensor.extractor(response, "delay");
int delayint = delayvalue.toInt();
Serial.println("getschema");
Serial.println(response);
Serial.println("send data");
Serial.println(jsonobj);
Serial.println("extractor delay");
Serial.println(delayint);
digitalWrite(buzz, LOW);
delay(delayint);
} else {
getsensorvalue();
digitalWrite(buzz, HIGH);
startBT();
Serial.println("NOT Recived");
restartcpount++;
if (restartcpount == 250) {
Serial.println("Restarted");
ESP.restart();
}
}
}
void getsensorvalue() {
uint16_t lux = lightMeter.readLightLevel();
Serial.print("Light: ");
Serial.print(lux);
lightvalue = String(lux);
delay(500);
Serial.println(" lx");
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Light: ");
lcd.setCursor(7, 0);
lcd.print(" ");
lcd.setCursor(7, 0);
lcd.print(lux);
lcd.print(" lx");
}
void startBT() {
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif
SerialBT.begin(NAME.c_str());
if (SerialBT.available()) {
String btdata = SerialBT.readString();
Serial.println(btdata);
StaticJsonDocument jsonDoc;
DeserializationError error = deserializeJson(jsonDoc, btdata);
if (error) {
Serial.print("deserializeJson() failed: ");
Serial.println(error.c_str());
return;
}
String datatype = jsonDoc["Datatype"];
if (datatype == "wifiupdate") {
String Nssid = jsonDoc["ssid"];
String Npass = jsonDoc["pass"];
preferences.putString("ssid", Nssid);
preferences.putString("pass", Npass);
Serial.println("wifiinfoupdated");
digitalWrite(buzz, HIGH);
delay(5000);
digitalWrite(buzz, LOW);
delay(10);
ESP.restart();
} else if (datatype == "wifiinfo") {
Serial.println("datatype = wifiinfo");
String apikey = jsonDoc["apikey"];
String userid = jsonDoc["userid"];
String deviceid = jsonDoc["deviceid"];
String ssid = jsonDoc["ssid"];
String pass = jsonDoc["pass"];
if (ssid.length() > 0 && pass.length() > 0 && apikey.length() > 0) {
preferences.putString("apikey", apikey);
preferences.putString("userid", userid);
preferences.putString("deviceid", deviceid);
preferences.putString("ssid", ssid);
preferences.putString("pass", pass);
Serial.println(apikey);
Serial.println(userid);
Serial.println(ssid);
Serial.println(pass);
digitalWrite(buzz, HIGH);
delay(2000);
digitalWrite(buzz, LOW);
delay(1000);
digitalWrite(buzz, HIGH);
delay(2000);
digitalWrite(buzz, LOW);
delay(1000);
ESP.restart();
}
}
}
}
Collapsible text is great for longer section titles and descriptions. It gives people access to all the info they need, while keeping your layout clean. Link your text to anything, or set your text box to expand on click. Write your text here...
bottom of page