From 20e85b908573bc1b49d845e2e6794081cd66505b Mon Sep 17 00:00:00 2001 From: chabisik Date: Thu, 15 Dec 2022 12:38:02 +0100 Subject: [PATCH] Adding functions --- executor_esp32.ino | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/executor_esp32.ino b/executor_esp32.ino index 8f68ec5..6dc95a1 100644 --- a/executor_esp32.ino +++ b/executor_esp32.ino @@ -1,8 +1,12 @@ #include +#include Servo myservo; // create servo object to control a servo int servoPin = 18; +const char* ssid = "dlink"; +const char* password = ""; + void closeCircuitAndOpen(int closeTime=400) { int pos = 0; @@ -20,6 +24,8 @@ void closeCircuitAndOpen(int closeTime=400) void setup() { + Serial.begin(115200); + //======SERVO PART======// // Allow allocation of all timers ESP32PWM::allocateTimer(0); ESP32PWM::allocateTimer(1); @@ -28,6 +34,17 @@ void setup() myservo.setPeriodHertz(50); // standard 50 hz servo myservo.attach(servoPin, 1000, 2000); // attaches the servo on pin 18 to the servo object myservo.write(0);delay(2500); // position to initial suitable position + //======WIFI PART======/ + WiFi.mode(WIFI_STA); //Optional + WiFi.begin(ssid, password); + Serial.println("\nConnecting"); + while(WiFi.status() != WL_CONNECTED){ + Serial.print("."); + delay(100); + } + Serial.println("\nConnected to the WiFi network"); + Serial.print("Local ESP32 IP: "); + Serial.println(WiFi.localIP()); } void loop()