Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP8266(ESPDUINO-32) A programmer is required to upload #153

Open
P-inc opened this issue Sep 25, 2023 · 0 comments
Open

ESP8266(ESPDUINO-32) A programmer is required to upload #153

P-inc opened this issue Sep 25, 2023 · 0 comments

Comments

@P-inc
Copy link

P-inc commented Sep 25, 2023

#include <ESP8266WiFi.h>
#include <Servo.h>
#define IO13 13

const char* ssid = ""; // Enter WiFi network name here
const char* password = ""; // Enter WiFi password here

const int servoPin = 13; // Servo motor pin settings
Servo servo; // Create Servo object

WiFiServer server(80); // Create WiFiServer object

int servoPosition = 0; // Current position of the servo motor (0 degrees or 90 degrees)

void setup() {
Serial.begin(115200);
delay(10);

servo. attach(servoPin); //connect to servo motor pin

// WiFi connection
Serial.println();
Serial.println("Connecting to WiFi...");
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("WiFi connected.");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());

server.begin();
}

void loop() {
WiFiClient client = server.available();
if (!client) {
return;
}

String request = client.readStringUntil('\r');
if (request.indexOf("/servo/on") != -1) {
// When approaching the "/servo/on" path, change the servo motor to ON state.
if (servoPosition == 0) {
servo.write(90); // Rotate servo motor to 90 degree position
servoPosition = 90;
}
} else if (request.indexOf("/servo/off") != -1) {
// When approaching the "/servo/off" path, change the servo motor to OFF state.
if (servoPosition == 90) {
servo.write(0); // Rotate servo motor to 0 degree position
servoPosition = 0;
}
}

// web page response
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println();
client.println("");
client.println("

Servo Control

");
client.println("

Turn Servo ON

");
client.println("

Turn Servo OFF

");
client.println("");

client.stop();
}

/////////////
. Variables and constants in RAM (global, static), used 28556 / 80192 bytes (35%)
║ SEGMENT BYTES DESCRIPTION
╠══ DATA 1504 initialized variables
╠══ RODATA 1196 constants
╚══ BSS 25856 zeroed variables
. Instruction RAM (IRAM_ATTR, ICACHE_RAM_ATTR), used 61183 / 65536 bytes (93%)
║ SEGMENT BYTES DESCRIPTION
╠══ ICACHE 32768 reserved space for flash instruction cache
╚══ IRAM 28415 code in IRAM
. Code in flash (default, ICACHE_FLASH_ATTR), used 248420 / 1048576 bytes (23%)
║ SEGMENT BYTES DESCRIPTION
╚══ IROM 248420 code in flash
A programmer is required to upload

The above error appears. Please tell me how to solve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant