Last active
February 9, 2023 18:00
-
-
Save omersiar/82d299cb30856bbfb3281d1b05757a55 to your computer and use it in GitHub Desktop.
bagaj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <ESP8266WiFi.h> | |
#ifndef WIFISSID | |
#define WIFISSID "" | |
#define WIFIPASS "" | |
#endif | |
#define RELAY 5 | |
const char* ssid = WIFISSID; | |
const char* password = WIFIPASS; | |
void setup() { | |
pinMode(RELAY, OUTPUT); | |
digitalWrite(RELAY, LOW); | |
WiFi.persistent(false); | |
delay(1); | |
if (!WiFi.mode(WIFI_STA) || !WiFi.begin(ssid, password) || (WiFi.waitForConnectResult(10000) != WL_CONNECTED)) { | |
WiFi.mode(WIFI_OFF); | |
ESP.deepSleep(3e8, RF_DISABLED); | |
return; | |
} | |
else { | |
digitalWrite(RELAY, HIGH); | |
delay(500); | |
digitalWrite(RELAY, LOW); | |
delay(60000); | |
} | |
ESP.restart(); | |
} | |
void loop() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment