top of page
1663008559109.png

Sensorflow

K6a4aIRll5uIFCyEE

Product Dashboard
Edit
Production
QR
Connected Devices

Product Name

Sensorflow PLC

Product Type

Hardware

Product ID

LcDOhnJ1HscXYkm1
Product Info
Add
Remove
Heading 5
Properties/ Schema
Check
Product Firmware

Your content has been submitted

An error occurred. Try again later

Production
Get Code

Device Name

User ID

Lastseen

SensorflowPLC6kaustubh
Fri Mar 15 2024 02:56 PM
SensorflowPLC5kaustubh
Wed Mar 06 2024 01:12 PM
Sensorflowplc My home black
Fri Sep 20 2024 09:52 PM
Sensorflow PLC kaustubh3
Fri Apr 26 2024 12:48 PM
Sensorflowplc1kaustubh
Mon Apr 22 2024 12:13 PM
Sensorflow PLC IFTDT
Tue Mar 26 2024 02:12 PM
Sensorflow PLC Saffron
Fri Sep 06 2024 12:32 AM
Sensorflow PLC Growth room 🪴
Wed May 22 2024 11:03 PM
1663008559109.png
Sensorflow PLC
LcDOhnJ1HscXYkm1
1663008559109.png
Sensorflow PLC
LcDOhnJ1HscXYkm1
1663008559109.png
Sensorflow PLC
LcDOhnJ1HscXYkm1
1663008559109.png
Sensorflow PLC
LcDOhnJ1HscXYkm1
1663008559109.png
Sensorflow PLC
LcDOhnJ1HscXYkm1
1663008559109.png
Sensorflow PLC
LcDOhnJ1HscXYkm1
1663008559109.png
Sensorflow PLC
LcDOhnJ1HscXYkm1
1663008559109.png
Sensorflow PLC
LcDOhnJ1HscXYkm1
1663008559109.png
Sensorflow PLC
LcDOhnJ1HscXYkm1
1663008559109.png
Sensorflow PLC
LcDOhnJ1HscXYkm1
1663008559109.png
Sensorflow PLC
LcDOhnJ1HscXYkm1
1663008559109.png
Sensorflow PLC
LcDOhnJ1HscXYkm1
1663008559109.png
Sensorflow PLC
LcDOhnJ1HscXYkm1
1663008559109.png
Sensorflow PLC
LcDOhnJ1HscXYkm1
#include #include #include #include #include #include BluetoothSerial HyperwisorBT; Preferences preferences; //21 scl and 22 sda #define CH_1 23 #define CH_2 19 #define CH_3 18 #define CH_4 5 #define CH_5 17 #define CH_6 4 #define CH_7 32 #define CH_8 33 #define CH_9 26 #define CH_10 27 #define CH_11 14 #define CH_12 12 #define buzz 2 //BLUE #define RED 13 //RED #define GREEN 15 //GREEN String NAME = "
"; String header; String apikey; String userid; String deviceid; String ssid; String pass; String E_CH1; String E_CH2; String E_CH3; String E_CH4; String E_CH5; String E_CH6; String E_CH7; String E_CH8; String E_CH9; String E_CH10; String E_CH11; String E_CH12; String E_delay; int restartcountdoun = 0; HYPERWISOR_IOT HyperwisorPLC; void setup() { esp_task_wdt_init(10, true); // Set the watchdog timer to 10 seconds Serial.begin(115200); Wire.begin(); // Disable sleep modes esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON); esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_ON); esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_ON); initializePins(); makelowPins(); preferences.begin("my-app", false); apikey = preferences.getString("apikey"); userid = preferences.getString("userid"); deviceid = preferences.getString("deviceid"); ssid = preferences.getString("ssid"); pass = preferences.getString("pass"); delay(50); HyperwisorPLC.init(apikey); Serial.println(apikey); Serial.println(userid); Serial.println(ssid); Serial.println(pass); E_CH1 = preferences.getString("PCH1"); E_CH2 = preferences.getString("PCH2"); E_CH3 = preferences.getString("PCH3"); E_CH4 = preferences.getString("PCH4"); E_CH5 = preferences.getString("PCH5"); E_CH6 = preferences.getString("PCH6"); E_CH7 = preferences.getString("PCH7"); E_CH8 = preferences.getString("PCH8"); E_CH9 = preferences.getString("PCH9"); E_CH10 = preferences.getString("PCH10"); E_CH11 = preferences.getString("PCH11"); E_CH12 = preferences.getString("PCH12"); E_delay = preferences.getString("Pdelay"); Serial.println(E_CH1); Serial.println(E_CH2); Serial.println(E_CH3); Serial.println(E_CH4); Serial.println(E_CH5); Serial.println(E_CH6); Serial.println(E_CH7); Serial.println(E_CH8); Serial.println(E_CH9); Serial.println(E_CH10); Serial.println(E_CH11); Serial.println(E_CH12); WiFi.disconnect(); delay(50); digitalWrite(buzz, HIGH); digitalWrite(RED, HIGH); WiFi.setHostname(NAME.c_str()); WiFi.begin(ssid.c_str(), pass.c_str()); Serial.println("Connecting..........."); delay(240000); Serial.println(ssid); Serial.println(pass); Serial.println(WiFi.localIP()); //digitalWrite(buzz, HIGH); delay(2000); digitalWrite(buzz, LOW); digitalWrite(RED, LOW); delay(100); changestate(); } void loop() { esp_task_wdt_reset(); // Reset the watchdog timer if (WiFi.status() == WL_CONNECTED) { digitalWrite(buzz, LOW); digitalWrite(RED, LOW); digitalWrite(GREEN, HIGH); String jsonobj = HyperwisorPLC.get_schema(); char json[1512]; String payload = jsonobj; Serial.println(payload); int leng = payload.length(); String newpayload = payload.substring(1, leng - 1); newpayload.replace(" ", ""); newpayload.replace("\n", ""); newpayload.trim(); newpayload.remove(0, 10); newpayload.toCharArray(json, 1512); StaticJsonDocument jsonDoc; DeserializationError error = deserializeJson(jsonDoc, newpayload); if (error) { Serial.print("deserializeJson() failed: "); Serial.println(error.c_str()); return; } // Serial.println(deviceid); // Serial.println(newpayload); String S_CH1 = jsonDoc["ch1"]; String S_CH2 = jsonDoc["ch2"]; String S_CH3 = jsonDoc["ch3"]; String S_CH4 = jsonDoc["ch4"]; String S_CH5 = jsonDoc["ch5"]; String S_CH6 = jsonDoc["ch6"]; String S_CH7 = jsonDoc["ch7"]; String S_CH8 = jsonDoc["ch8"]; String S_CH9 = jsonDoc["ch9"]; String S_CH10 = jsonDoc["ch10"]; String S_CH11 = jsonDoc["ch11"]; String S_CH12 = jsonDoc["ch12"]; String S_delay = jsonDoc["delay"]; String i2c_status = jsonDoc["i2c"]; int S_address = jsonDoc["address"]; String S_data = jsonDoc["data"]; if (i2c_status == "1") { send_over_i2c(S_address, S_data); //Serial.println(i2cdata); digitalWrite(buzz, LOW); digitalWrite(RED, HIGH); digitalWrite(GREEN, LOW); HyperwisorPLC.update_schema("i2c=0"); delay(100); } else { Serial.println("No i2c Data"); } delay(S_delay.toInt()); Serial.println(S_delay); delay(100); E_CH1 = preferences.getString("PCH1"); E_CH2 = preferences.getString("PCH2"); E_CH3 = preferences.getString("PCH3"); E_CH4 = preferences.getString("PCH4"); E_CH5 = preferences.getString("PCH5"); E_CH6 = preferences.getString("PCH6"); E_CH7 = preferences.getString("PCH7"); E_CH8 = preferences.getString("PCH8"); E_CH9 = preferences.getString("PCH9"); E_CH10 = preferences.getString("PCH10"); E_CH11 = preferences.getString("PCH11"); E_CH12 = preferences.getString("PCH12"); //E_delay = preferences.getString("Pdelay"); if (E_CH1 != S_CH1) { preferences.putString("PCH1", S_CH1); delay(10); changestate(); Serial.println("updated1" + S_CH1); } else { Serial.println(E_CH1); } if (E_CH2 != S_CH2) { preferences.putString("PCH2", S_CH2); delay(10); changestate(); Serial.println("updated2" + S_CH2); } else { Serial.println(E_CH2); } if (E_CH3 != S_CH3) { preferences.putString("PCH3", S_CH3); delay(10); changestate(); Serial.println("updated3" + S_CH3); } else { Serial.println(E_CH3); } if (E_CH4 != S_CH4) { preferences.putString("PCH4", S_CH4); delay(10); changestate(); Serial.println("updated4" + S_CH4); } else { Serial.println(E_CH4); } if (E_CH5 != S_CH5) { preferences.putString("PCH5", S_CH5); delay(10); changestate(); Serial.println("updated5" + S_CH5); } else { Serial.println(E_CH5); } if (E_CH6 != S_CH6) { preferences.putString("PCH6", S_CH6); delay(10); changestate(); Serial.println("updated6" + S_CH6); } else { Serial.println(E_CH6); } if (E_CH7 != S_CH7) { preferences.putString("PCH7", S_CH7); delay(10); changestate(); Serial.println("updated7" + S_CH7); } else { Serial.println(E_CH7); } if (E_CH8 != S_CH8) { preferences.putString("PCH8", S_CH8); delay(10); changestate(); Serial.println("updated8" + S_CH8); } else { Serial.println(E_CH8); } if (E_CH9 != S_CH9) { preferences.putString("PCH9", S_CH9); delay(10); changestate(); Serial.println("updated9" + S_CH9); } else { Serial.println(E_CH9); } if (E_CH10 != S_CH10) { preferences.putString("PCH10", S_CH10); delay(10); changestate(); Serial.println("updated10" + S_CH10); } else { Serial.println(E_CH10); } if (E_CH11 != S_CH11) { preferences.putString("PCH11", S_CH11); delay(10); changestate(); Serial.println("updated11" + S_CH11); } else { Serial.println(E_CH11); } if (E_CH12 != S_CH12) { preferences.putString("PCH12", S_CH12); delay(10); changestate(); Serial.println("updated12" + S_CH12); } else { Serial.println(E_CH12); } String iftdtresponse = HyperwisorPLC.runiftdt(); delay(500); String scheduleresponse = HyperwisorPLC.runscheule(); Serial.println(iftdtresponse); Serial.println(scheduleresponse); } else { startBT(); } } void initializePins() { pinMode(CH_1, OUTPUT); pinMode(CH_2, OUTPUT); pinMode(CH_3, OUTPUT); pinMode(CH_4, OUTPUT); pinMode(CH_5, OUTPUT); pinMode(CH_6, OUTPUT); pinMode(CH_7, OUTPUT); pinMode(CH_8, OUTPUT); pinMode(CH_9, OUTPUT); pinMode(CH_10, OUTPUT); pinMode(CH_11, OUTPUT); pinMode(CH_12, OUTPUT); pinMode(buzz, OUTPUT); pinMode(RED, OUTPUT); pinMode(GREEN, OUTPUT); } void makelowPins() { digitalWrite(CH_1, LOW); digitalWrite(CH_2, LOW); digitalWrite(CH_3, LOW); digitalWrite(CH_4, LOW); digitalWrite(CH_5, LOW); digitalWrite(CH_6, LOW); digitalWrite(CH_7, LOW); digitalWrite(CH_8, LOW); digitalWrite(CH_9, LOW); digitalWrite(CH_10, LOW); digitalWrite(CH_11, LOW); digitalWrite(CH_12, LOW); digitalWrite(buzz, LOW); digitalWrite(RED, LOW); digitalWrite(GREEN, LOW); } void changestate() { digitalWrite(buzz, LOW); digitalWrite(RED, HIGH); digitalWrite(GREEN, LOW); Serial.println("CHANGE STATE"); E_CH1 = preferences.getString("PCH1"); E_CH2 = preferences.getString("PCH2"); E_CH3 = preferences.getString("PCH3"); E_CH4 = preferences.getString("PCH4"); E_CH5 = preferences.getString("PCH5"); E_CH6 = preferences.getString("PCH6"); E_CH7 = preferences.getString("PCH7"); E_CH8 = preferences.getString("PCH8"); E_CH9 = preferences.getString("PCH9"); E_CH10 = preferences.getString("PCH10"); E_CH11 = preferences.getString("PCH11"); E_CH12 = preferences.getString("PCH12"); if (E_CH1 == "0") { digitalWrite(CH_1, LOW); } else { //analogWrite(CH_1, E_CH1.toInt()); digitalWrite(CH_1, HIGH); } delay(10); if (E_CH2 == "0") { digitalWrite(CH_2, LOW); } else if (E_CH2 != 0) { digitalWrite(CH_2, HIGH); // analogWrite(CH_2, E_CH2.toInt()); } delay(10); if (E_CH3 == "0") { digitalWrite(CH_3, LOW); //analogWrite(CH_3, E_CH3.toInt()); } else { digitalWrite(CH_3, HIGH); // analogWrite(CH_3, E_CH3.toInt()); } delay(10); if (E_CH4 == "0") { digitalWrite(CH_4, LOW); //analogWrite(CH_4, E_CH4.toInt()); } else { digitalWrite(CH_4, HIGH); // analogWrite(CH_4, E_CH4.toInt()); } delay(10); if (E_CH5 == "0") { digitalWrite(CH_5, LOW); //analogWrite(CH_5, E_CH5.toInt()); } else { digitalWrite(CH_5, HIGH); // analogWrite(CH_5, E_CH5.toInt()); } delay(10); if (E_CH6 == "0") { digitalWrite(CH_6, LOW); } else { digitalWrite(CH_6, HIGH); } delay(10); if (E_CH7 == "0") { digitalWrite(CH_7, LOW); //Serial.println("check 7 low : " + E_CH7); } else { digitalWrite(CH_7, HIGH); // Serial.println("check 7 high : " + E_CH7); } delay(10); if (E_CH8 == "0") { digitalWrite(CH_8, LOW); } else { digitalWrite(CH_8, HIGH); } delay(10); if (E_CH9 == "0") { digitalWrite(CH_9, LOW); } else { digitalWrite(CH_9, HIGH); } delay(10); if (E_CH10 == "0") { digitalWrite(CH_10, LOW); } else { digitalWrite(CH_10, HIGH); } delay(10); if (E_CH11 == "0") { digitalWrite(CH_11, LOW); } else { digitalWrite(CH_11, HIGH); } delay(10); if (E_CH12 == "0") { digitalWrite(CH_12, LOW); } else { digitalWrite(CH_12, HIGH); } delay(10); // Serial.println(E_CH1); // Serial.println(E_CH2); // Serial.println(E_CH3); // Serial.println(E_CH4); // Serial.println(E_CH5); // Serial.println(E_CH6); // Serial.println(E_CH7); // Serial.println(E_CH8); // Serial.println(E_CH9); // Serial.println(E_CH10); // Serial.println(E_CH11); // Serial.println(E_CH12); // Serial.println(E_CI); // Serial.println(E_Active); // digitalWrite(RED, LOW); // digitalWrite(GREEN, HIGH); } void send_over_i2c(int address, String data) { Wire.beginTransmission(address); Wire.write(data.c_str()); // Convert String to const char* using c_str() Wire.endTransmission(); Serial.println("i2c data recived:"); Serial.println(data); // return "201"; } 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 HyperwisorBT.begin(NAME.c_str()); if (HyperwisorBT.available()) { String btdata = HyperwisorBT.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 == "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); preferences.putString("PCH1", "0"); preferences.putString("PCH2", "0"); preferences.putString("PCH3", "0"); preferences.putString("PCH4", "0"); preferences.putString("PCH5", "0"); preferences.putString("PCH6", "0"); preferences.putString("PCH7", "0"); preferences.putString("PCH8", "0"); preferences.putString("PCH9", "0"); preferences.putString("PCH10", "0"); preferences.putString("PCH11", "0"); preferences.putString("PCH12", "0"); Serial.println(apikey); Serial.println(userid); Serial.println(ssid); Serial.println(pass); digitalWrite(GREEN, HIGH); delay(2000); digitalWrite(GREEN, LOW); delay(1000); digitalWrite(buzz, HIGH); delay(2000); digitalWrite(buzz, LOW); delay(1000); ESP.restart(); } } else if (datatype == "BTCONTROLL") { Serial.println("datatype = BTCONTROLL"); String S_CH1 = jsonDoc["ch1"]; String S_CH2 = jsonDoc["ch2"]; String S_CH3 = jsonDoc["ch3"]; String S_CH4 = jsonDoc["ch4"]; String S_CH5 = jsonDoc["ch5"]; String S_CH6 = jsonDoc["ch6"]; String S_CH7 = jsonDoc["ch7"]; String S_CH8 = jsonDoc["ch8"]; String S_CH9 = jsonDoc["cH9"]; String S_CH10 = jsonDoc["ch10"]; String S_CH11 = jsonDoc["ch11"]; String S_CH12 = jsonDoc["ch12"]; delay(500); Serial.println(E_CH1); Serial.println(E_CH2); Serial.println(E_CH3); Serial.println(E_CH4); Serial.println(E_CH5); Serial.println(E_CH6); Serial.println(E_CH7); Serial.println(E_CH8); Serial.println(E_CH9); Serial.println(E_CH10); Serial.println(E_CH11); Serial.println(E_CH12); if (E_CH1 != S_CH1) { preferences.putString("PCH1", S_CH1); Serial.println("updated1" + S_CH1); changestate(); } else { Serial.println(E_CH1); } if (E_CH2 != S_CH2) { preferences.putString("PCH2", S_CH2); Serial.println("updated2" + S_CH2); changestate(); } else { Serial.println(E_CH2); } if (E_CH3 != S_CH3) { preferences.putString("PCH3", S_CH3); Serial.println("updated3" + S_CH3); changestate(); } else { Serial.println(E_CH3); } if (E_CH4 != S_CH4) { preferences.putString("PCH4", S_CH4); Serial.println("updated4" + S_CH4); changestate(); } else { Serial.println(E_CH4); } if (E_CH5 != S_CH5) { preferences.putString("PCH5", S_CH5); Serial.println("updated5" + S_CH5); changestate(); } else { Serial.println(E_CH5); } if (E_CH6 != S_CH6) { preferences.putString("PCH6", S_CH6); Serial.println("updated6" + S_CH6); changestate(); } else { Serial.println(E_CH6); } if (E_CH7 != S_CH7) { preferences.putString("PCH7", S_CH7); Serial.println("updated7" + S_CH7); changestate(); } else { Serial.println(E_CH7); } if (E_CH8 != S_CH8) { preferences.putString("PCH8", S_CH8); Serial.println("updated8" + S_CH8); changestate(); } else { Serial.println(E_CH8); } if (E_CH9 != S_CH9) { preferences.putString("PCH9", S_CH9); Serial.println("updated9" + S_CH9); changestate(); } else { Serial.println(E_CH9); } if (E_CH10 != S_CH10) { preferences.putString("PCH10", S_CH10); Serial.println("updated10" + S_CH10); changestate(); } else { Serial.println(E_CH10); } if (E_CH11 != S_CH11) { preferences.putString("PCH11", S_CH11); Serial.println("updated11" + S_CH11); changestate(); } else { Serial.println(E_CH11); } if (E_CH12 != S_CH12) { preferences.putString("PCH12", S_CH12); Serial.println("updated12" + S_CH12); changestate(); } else { Serial.println(E_CH12); } } else 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 == "RESTART") { ESP.restart(); } } else { Serial.println("NOT RECIVED"); digitalWrite(buzz, HIGH); delay(50); digitalWrite(buzz, LOW); delay(50); restartcountdoun++; if (restartcountdoun == 1500) { 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