Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <WiFi.h> /* wifi functionality */
#include <Servo.h> /* servo functionality */
const char* ssid = "lemur"; /* network name */
const char* password = "lemu" /* network password */
const int SERVO_LEFT = D1; /* declaring right and left servos */
const int SERVO_RIGHT = D2;
Servo servo_left;
Servo servo_right;
void setup() {
Serial.begin(115200); /* serial montiro of Arduino IDE */
scanNetwork(); /* scan available WiFi networks & print info about them*/
connectToNetwork(); /* connect device to WiFi network*/
Serial.println(WiFi.localIP()); /* ESP32 should have local IP, to get it, call localIP method of WiFi ectern variable */
Serial.println(WiFi.macAddress()); /* call macAddress method on WiFi ectern variable */
WiFi.disconnect(true); /* pass value of true to disable WiFi */
Serial.println(WiFi.localIP()); /* call method to get IP again to confirm disconnect from network and no IP assigned */
servosWakeUp();
}
void setup() { /* code for boat servos (make a loop or command for it) */
servo_left.attach(SERVO_LEFT);
servo_right.attach(SERVO_RIGHT);
servo_left.write(0);
servo_right.write(180);
}
void servosWakeUp() {
servo_left.attach(SERVO_LEFT);
servo_right.attach(SERVO_RIGHT);
servo_left.write(0);
servo_right.write(180);
}
#include <Servo.h>
static const int SERVO-LEFT = D1;
static const int SERVO-RIGHT = D2;
Servo servo_left;
Servo servo_right;
void setup() {
Serial.begin(115200);
servo_left.attach(SERVO-LEFT);
servo_right.attach(SERVO-RIGHT);
servoMove();
}
void servoMove() {
servo_left.write(0);
servo_right.write(180);
}