Skip to content

Instantly share code, notes, and snippets.

@vivekanandRdhakane
Last active April 3, 2020 13:44
Show Gist options
  • Save vivekanandRdhakane/2d8525ead0fb692bd1476ffdc7fdd10b to your computer and use it in GitHub Desktop.
Save vivekanandRdhakane/2d8525ead0fb692bd1476ffdc7fdd10b to your computer and use it in GitHub Desktop.
This code is for Circuit breaker
//Author: Vivekanand Dhakane
//Uploaded on: 2 March 2020
#include <ESP8266WiFi.h>
#define ctr 0 //D3 of NodeMCU
int count=0;
void setup() {
WiFi.disconnect();
WiFi.forceSleepBegin();
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
pinMode(ctr, OUTPUT);
digitalWrite(ctr, HIGH);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
count++;
if(count==5)
{
WiFi.forceSleepWake();
digitalWrite(ctr, LOW);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment