tenbaht / sduino

An Arduino-like programming API for the STM8
http://tenbaht.github.io/sduino/
GNU Lesser General Public License v2.1
351 stars 217 forks source link

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

Open P-inc opened 1 year ago

P-inc commented 1 year ago

include

include

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.