Using Arduino IDE to verify a sketch and received this Compilation error: Exit Status 255

Using Arduino IDE 2.3.4 to verify a sketch and received this Compilation error: Exit Status 255.

What I'm trying to do is use an existing sketch created by someone else (as explained in the attached sketch) and then upload it to my ESP32 Servo Driver Expansion board w/built in WiFi & Bluetooth. Then I can use the ESP32 Kit App on my iPhone to operate the ESP32 Servo driver Expansion board wirelessly.
esp32_sketch_v1.1.ino.txt (17.5 KB)

While verifying my sketch using Arduino IDE 2.3.4, I received a Compilation error: Exist status 255. Can someone help to resolve this error ?


```cpp
/*
  Title  : ESP32 Kit
  version: V1.1
  Contact: info@tatco.cc
  Done By: TATCO Inc.
  github : https://github.com/rabee2050/esp32-kit
  Youtube: http://tatco.cc

  Apps:
  iOS    : https://apps.apple.com/us/app/esp32-kit/id1498601142?ls=1
  Android: Coming Soon.

  Release Notes:
  - V1.1 Created 29 Dec 2019

  
  Installation instructions using Arduino IDE Boards Manager:
  1- Go to this link and follow the instructions:
  https://github.com/espressif/arduino-esp32/blob/master/README.md
  2- Go to Tools/Board/Boards Manager
  3- Search for: ESP32
  4- Install the Package: esp32 by Espress Systems version 1.0.4
  5- Go to Tools/Board then select ESP32 Dev Module
  6- Go to Tools/Partition Scheme then select Huge App(3MB No OTA / 1MB SPIFFS)
  7- Update the below WIFI creditntial to your WIFI ssid and password.
  8- That's it, Now you can upload the sketch to your board.
  
  Connection:
  - No connections are required, Just upload the sketch to your ESP32 board.

*/

#include <WiFi.h>

const char *ssid = "STCNS";          //Must be changed to Your WIFI SSID Name
const char *password = "asd123zxc";  //Must be changed to Your WIFI Password
WiFiServer server(80);
String httpAppJsonOk = "HTTP/1.1 200 OK\r\n content-type:application/json \r\n\r\n";
String httpTextPlainOk = "HTTP/1.1 200 OK\r\n content-type:text/plain \r\n\r\n";
unsigned long serialTimer = millis();

#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>
#include <BLE2902.h>

#define SERVICE_UUID "ffe0"
#define CHARACTERISTIC_UUID "ffe1"
BLECharacteristic *pCharacteristic;



String appBuildVersion = "1.1";
String boardType = "esp32";
String protectionPassword = "";  //This will prevent people to add or control your board.
int refreshTime = 3;             //the data will be updated on the app every 3 seconds.
#define lcdSize 3                //this will define number of virtual LCD display on the app LCD Dashboard tab.
String feedBack;

char pinsMode[54];
int pinsValue[54];
String lcd[lcdSize];

unsigned long last = millis();
bool deviceConnected = false;

class MyServerCallbacks : public BLEServerCallbacks {
  void onConnect(BLEServer *pServer) {
    deviceConnected = true;
    Serial.println("Bluetooth is Connected");
  };

  void onDisconnect(BLEServer *pServer) {
    deviceConnected = false;
    Serial.println("Bluetooth is Disconnected");
  }
};

void setup() {
  Serial.begin(115200);
  Serial.println("Waiting the app connection to notify...");

  for (byte i = 0; i <= 16; i++) {  //Init for PWM & Servo
    ledcSetup(i, 50, 8);
  }

  BLEDevice::init("ESP32-BLE");  //Board BLE Name
  BLEServer *pServer = BLEDevice::createServer();
  pServer->setCallbacks(new MyServerCallbacks());

  BLEService *pService = pServer->createService(SERVICE_UUID);

  pCharacteristic = pService->createCharacteristic(
    CHARACTERISTIC_UUID,
    BLECharacteristic::PROPERTY_READ | BLECharacteristic::PROPERTY_WRITE | BLECharacteristic::PROPERTY_NOTIFY);

  pCharacteristic->addDescriptor(new BLE2902());

  class MyCallbacks : public BLECharacteristicCallbacks {
    void onWrite(BLECharacteristic *pCharacteristic) {
      std::string value = pCharacteristic->getValue();
      if (value.length() > 0) {
        String dataIncoming = "";
        for (int i = 0; i < value.length(); i++) {
          dataIncoming += value[i];
        }
        int commaIndex = dataIncoming.indexOf('/');
        int secondCommaIndex = dataIncoming.indexOf('/', commaIndex + 1);
        int thirdCommaIndex = dataIncoming.indexOf('/', secondCommaIndex + 1);

        String first = dataIncoming.substring(0, commaIndex);                          //Commands like: mode, digital, analog, servo,etc...
        String second = dataIncoming.substring(commaIndex + 1, secondCommaIndex);      //Pin number.
        String third = dataIncoming.substring(secondCommaIndex + 1, thirdCommaIndex);  // value of the pin.
        String forth = dataIncoming.substring(thirdCommaIndex + 1);                    //not used,it is for future provision.
        process(first, second, third, forth);
        delay(50);
      }
    }
  };

  pCharacteristic->setCallbacks(new MyCallbacks());
  pService->start();
  BLEAdvertising *pAdvertising = pServer->getAdvertising();
  pAdvertising->start();
  pAdvertising->addServiceUUID(SERVICE_UUID);
  BLEDevice::startAdvertising();

  //*******************************************
  // We start by connecting to a WiFi network
  Serial.println();
  WiFi.mode(WIFI_AP_STA);                     //WIFI_AP, WIFI_STA, WIFI_AP_STA or WIFI_OFF
  WiFi.softAP("ESP32-WIFI-AP", "123456789");  //(APname, password)
  WiFi.begin(ssid, password);
  Serial.println("");
  Serial.printf("Connecting to %s........", ssid);
  Serial.println("");

  if (WiFi.waitForConnectResult() != WL_CONNECTED) {
    notConnectedToWifiNetwork();
  } else {
    connectedToWifiNetwork();
  }

  server.begin();
  //*******************************************
  boardInit();
}

void loop() {


  updateLcdValues();
  updateInputValues();  //if it is input then update pin value.
  if (deviceConnected) {
    updateApp();  //Send data to mobile app every specific time
  }
  //*****************************
  serialPrintIpAddress();
  WiFiClient client = server.available();

  if (!client) {
    return;
  }
  while (!client.available()) {
    delay(1);
  }
  process_WIFI(client);
  //******************************
}

void updateLcdValues() {
  lcd[0] = "Test 1 LCD";    // Send any data to the virtual LCD dashboard in the App.
  lcd[1] = analogRead(A0);  // Send analog value of A0 to the virtual LCD dashboard in the App.
  lcd[2] = random(1, 100);  // Send any data to the virtual LCD dashboard in the App.
}

void process(String command, String second, String third, String forth) {

  if (command == "terminal") {  //to recieve data from mobile app from terminal text box
    terminalCommand(second);
  }

  if (command == "digital") {  //to turn pins on or off
    digitalCommand(second, third);
  }

  if (command == "pwm") {  //to write analog value(PWM).
    pwmCommand(second, third);
  }

  if (command == "mode") {  //to chang the mode of the pin.
    modeCommand(second, third);
  }

  if (command == "servo") {  // to control servo(0°-180°).
    servoCommand(second, third);
  }

  if (command == "allonoff") {  //to turn all pins on or off.
    allonoff(second, third);
  }
  if (command == "refresh") {  // to change the refresh time.
    refresh(second);
  }

  if (command == "allstatus") {  // send JSON object arduino includes all data.
    feedBack = "refresh/";
    allstatus();
  }
}

void terminalCommand(String second) {  //Here you recieve data form app terminal
  String data = second;
  Serial.println(data);

  String replyToApp = "Ok from Arduino";  //It can be change to any thing

  feedBack = "terminal/" + replyToApp;  //dont change this line.
  allstatus();
}

void digitalCommand(String second, String third) {
  int pin, value;
  pin = second.toInt();
  value = third.toInt();

  digitalWrite(pin, value);
  pinsValue[pin] = value;
}

void pwmCommand(String second, String third) {
  int pin, value;
  pin = second.toInt();
  value = third.toInt();
  ledcWrite(pin, value);
  pinsValue[pin] = value;
}

void servoCommand(String second, String third) {
  int pin, value;
  pin = second.toInt();
  value = third.toInt();
  int valueMapped = map(value, 0, 180, 10, 32);
  ledcWrite(pin, valueMapped);
  pinsValue[pin] = value;
}

void modeCommand(String second, String third) {
  int pin = second.toInt();
  String mode = third;

  if (mode != "pwm") {
    ledcDetachPin(pin);
  };

  if (mode != "servo") {
    ledcDetachPin(pin);
  };

  if (mode == "output") {
    pinMode(pin, OUTPUT);
    digitalWrite(pin, 0);
    pinsMode[pin] = 'o';
    pinsValue[pin] = 0;
  }
  if (mode == "push") {
    pinsMode[pin] = 'm';
    pinsValue[pin] = 0;
    pinMode(pin, OUTPUT);
    digitalWrite(pin, 0);
  }
  if (mode == "schedule") {
    pinsMode[pin] = 'c';
    pinsValue[pin] = 0;
    pinMode(pin, OUTPUT);
    digitalWrite(pin, 0);
  }

  if (mode == "input") {
    pinsMode[pin] = 'i';
    pinsValue[pin] = 0;
    pinMode(pin, INPUT);
  }

  if (mode == "pwm") {
    pinsMode[pin] = 'p';
    pinsValue[pin] = 0;
    ledcAttachPin(pin, pin);
    ledcWrite(pin, 0);
  }

  if (mode == "servo") {
    pinsMode[pin] = 's';
    pinsValue[pin] = 0;
    ledcAttachPin(pin, pin);
    ledcWrite(pin, 0);
  }

  feedBack = "mode/" + mode + "/" + pin + "/" + pinsValue[pin];
  allstatus();
}

void allonoff(String second, String third) {
  //  int pin, value;
  //  pin = second.toInt();
  int value = third.toInt();
  for (byte i = 0; i < sizeof(pinsMode); i++) {
    if (pinsMode[i] == 'o') {
      digitalWrite(i, value);
      pinsValue[i] = value;
    }
  }
}


void updateApp() {

  if (refreshTime != 0) {
    unsigned int refreshVal = refreshTime * 1000;
    if (millis() - last > refreshVal) {
      allstatus();
      last = millis();
    }
  }
}

void refresh(String second) {
  int value = second.toInt();
  refreshTime = value;
  allstatus();
}

void allstatus() {
  String dataResponse;
  dataResponse += "{";

  dataResponse += "\"m\":[";  //m for mode
  for (byte i = 0; i <= 39; i++) {
    dataResponse += "\"";
    dataResponse += pinsMode[i];
    dataResponse += "\"";
    if (i != 39) dataResponse += ",";
  }
  dataResponse += "],";

  dataResponse += "\"v\":[";  //v for value
  for (byte i = 0; i <= 39; i++) {
    dataResponse += pinsValue[i];
    if (i != 39) dataResponse += ",";
  }
  dataResponse += "],";

  dataResponse += "\"a\":[";  //a for analog value
  for (byte i = 32; i <= 39; i++) {
    if (i == 37 || i == 38) {

    } else {
      dataResponse += analogRead(i);

      if (i != 39) dataResponse += ",";
    }
  }
  dataResponse += "],";

  dataResponse += "\"l\":[";  //l for LCD value
  for (byte i = 0; i <= lcdSize - 1; i++) {
    dataResponse += "\"";
    dataResponse += lcd[i];
    dataResponse += "\"";
    if (i != lcdSize - 1) dataResponse += ",";
  }
  dataResponse += "],";

  dataResponse += "\"t\":\"";  //t for Board Type .
  dataResponse += boardType;
  dataResponse += "\",";
  dataResponse += "\"f\":\"";  //f for feedback .
  dataResponse += feedBack;
  dataResponse += "\",";
  dataResponse += "\"r\":\"";  //r for refresh time .
  dataResponse += "3";
  dataResponse += "\",";
  dataResponse += "\"b\":\"";  //b for app build version .
  dataResponse += appBuildVersion;
  dataResponse += "\",";
  dataResponse += "\"p\":\"";  // p for Password.
  dataResponse += protectionPassword;
  dataResponse += "\"";
  dataResponse += "}";

  char dataBuffer[20];  //Charachtristic hold 20byte per time.
  int dataResponseLength = dataResponse.length();
  for (int i = 0; i <= dataResponseLength; i = i + 20) {
    for (int x = 0; x < 20; x++) {
      dataBuffer[x] = dataResponse[i + x];
    }
    pCharacteristic->setValue((unsigned char *)dataBuffer, 20);  // update the buffer
    pCharacteristic->notify();                                   // Send the value to the app!
  }
  pCharacteristic->setValue((unsigned char *)"\n", 2);
  pCharacteristic->notify();  // Send the value to the app!;
  feedBack = "";
}


void updateInputValues() {
  for (unsigned int i = 0; i < sizeof(pinsMode); i++) {
    if (pinsMode[i] == 'i') {
      pinsValue[i] = digitalRead(i);
    }
  }
}

void boardInit() {
  for (byte i = 0; i <= 39; i++) {
    if (i == 0 || i == 1 || i == 3 || i == 6 || i == 7 || i == 8 || i == 9 || i == 10 || i == 11 || i == 20 || i == 24 || i == 28 || i == 29 || i == 30 || i == 31 || i == 37 || i == 38) {  //Not used pins
      pinsMode[i] = 'x';
      pinsValue[i] = 0;
    } else if (i == 32 || i == 33 || i == 34 || i == 35 || i == 36 || i == 39) {  //analog inputs
      pinsMode[i] = 'x';
      pinsValue[i] = 0;
      pinMode(i, INPUT);
    } else {
      pinsMode[i] = 'o';
      pinsValue[i] = 0;
      pinMode(i, OUTPUT);
    }
  }
}

//********************************************

void connectedToWifiNetwork() {
  Serial.println("");
  Serial.println("WiFi is connected, the IP address: ");
  Serial.println(WiFi.localIP());
}

void notConnectedToWifiNetwork() {
  WiFi.mode(WIFI_AP);                         //WIFI_AP, WIFI_STA, WIFI_AP_STA or WIFI_OFF
  WiFi.softAP("ESP32-WIFI-AP", "123456789");  //(APname, password)
  Serial.println("");
  Serial.printf("WiFi connection failed to the network '%s', but you can still connect to board as it is Access Point:", ssid);
  Serial.println("");
  Serial.println("1- Go to your mobile WiFi settings and connect to a network Called: 'ESP32-WIFI-AP'.");
  Serial.println("2- The default WiFi password is: '123456789'.");
  Serial.print("3- Open the ESP32 Kit app and insert this IP Address: ");
  Serial.println("192.168.4.1");
  Serial.println("4- Press the check button then you will be able to control your board!.");
}

void serialPrintIpAddress() {
  if (Serial.available()) {
    if (Serial.read() > 0) {
      if (millis() - serialTimer > 2000) {
        if (WiFi.status() == WL_CONNECTED) {
          connectedToWifiNetwork();
        } else {
          notConnectedToWifiNetwork();
        }
      }
      serialTimer = millis();
    }
  }
}

void process_WIFI(WiFiClient client) {
  String getString = client.readStringUntil('/');
  String arduinoString = client.readStringUntil('/');
  String command = client.readStringUntil('/');

  if (command == "digital") {
    digitalCommand_WIFI(client);
  }

  if (command == "pwm") {
    pwmCommand_WIFI(client);
  }

  if (command == "servo") {
    servoCommand_WIFI(client);
  }

  if (command == "terminal") {
    terminalCommand_WIFI(client);
  }

  if (command == "mode") {
    modeCommand_WIFI(client);
  }

  if (command == "allonoff") {
    allonoff_WIFI(client);
  }

  if (command == "password") {
    changePassword_WIFI(client);
  }

  if (command == "allstatus") {
    allstatus_WIFI(client);
  }
}

void terminalCommand_WIFI(WiFiClient client) {  //Here you recieve data form app terminal
  String data = client.readStringUntil('/');
  client.print(httpAppJsonOk + "Ok from Arduino " + String(random(1, 100)));
  Serial.println(data);
}

void digitalCommand_WIFI(WiFiClient client) {
  int pin, value;
  pin = client.parseInt();
  if (client.read() == '/') {
    value = client.parseInt();
    digitalWrite(pin, value);
    pinsValue[pin] = value;
    client.print(httpAppJsonOk + value);
  }
}

void pwmCommand_WIFI(WiFiClient client) {
  int pin, value;
  pin = client.parseInt();
  if (client.read() == '/') {
    value = client.parseInt();
    ledcWrite(pin, value);
    pinsValue[pin] = value;
    client.print(httpAppJsonOk + value);
  }
}

void servoCommand_WIFI(WiFiClient client) {
  int pin, value;
  pin = client.parseInt();
  if (client.read() == '/') {
    value = client.parseInt();
    int valueMapped = map(value, 0, 180, 10, 35);
    ledcWrite(pin, valueMapped);
    pinsValue[pin] = value;
    client.print(httpAppJsonOk + value);
  }
}

void modeCommand_WIFI(WiFiClient client) {
  String pinString = client.readStringUntil('/');
  int pin = pinString.toInt();
  String mode = client.readStringUntil('/');

  if (mode != "servo") {
    ledcDetachPin(pin);
  };

  if (mode != "pwm") {
    ledcDetachPin(pin);
  };

  if (mode == "output") {
    pinMode(pin, OUTPUT);
    digitalWrite(pin, 0);
    pinsMode[pin] = 'o';
    pinsValue[pin] = 0;
    allstatus_WIFI(client);
  }
  if (mode == "push") {
    pinsMode[pin] = 'm';
    pinsValue[pin] = 0;
    pinMode(pin, OUTPUT);
    digitalWrite(pin, 0);
    allstatus_WIFI(client);
  }
  if (mode == "schedule") {
    pinsMode[pin] = 'c';
    pinsValue[pin] = 0;
    pinMode(pin, OUTPUT);
    digitalWrite(pin, 0);
    allstatus_WIFI(client);
  }

  if (mode == "input") {
    pinsMode[pin] = 'i';
    pinsValue[pin] = 0;
    pinMode(pin, INPUT);
    allstatus_WIFI(client);
  }

  if (mode == "pwm") {
    pinsMode[pin] = 'p';
    pinsValue[pin] = 0;
    ledcAttachPin(pin, pin);
    ledcWrite(pin, 0);
    allstatus_WIFI(client);
  }

  if (mode == "servo") {
    pinsMode[pin] = 's';
    pinsValue[pin] = 0;
    ledcAttachPin(pin, pin);
    ledcWrite(pin, 0);
    allstatus_WIFI(client);
  }
}

void allonoff_WIFI(WiFiClient client) {
  int pin, value;
  value = client.parseInt();
  for (byte i = 0; i <= 39; i++) {
    if (pinsMode[i] == 'o') {
      digitalWrite(i, value);
      pinsValue[i] = value;
    }
  }
  client.print(httpTextPlainOk + value);
}

void changePassword_WIFI(WiFiClient client) {
  String data = client.readStringUntil('/');
  protectionPassword = data;
  client.print(httpAppJsonOk);
}

void allstatus_WIFI(WiFiClient client) {
  String dataResponse;
  dataResponse += F("HTTP/1.1 200 OK \r\n");
  dataResponse += F("content-type:application/json \r\n\r\n");
  dataResponse += "{";

  dataResponse += "\"m\":[";  //m for mode
  for (byte i = 0; i <= 39; i++) {
    dataResponse += "\"";
    dataResponse += pinsMode[i];
    dataResponse += "\"";
    if (i != 39) dataResponse += ",";
  }
  dataResponse += "],";

  dataResponse += "\"v\":[";  //v for value
  for (byte i = 0; i <= 39; i++) {
    dataResponse += pinsValue[i];
    if (i != 39) dataResponse += ",";
  }
  dataResponse += "],";

  dataResponse += "\"a\":[";  //a for analog value
  for (byte i = 32; i <= 39; i++) {
    if (i == 37 || i == 38) {

    } else {
      dataResponse += analogRead(i);
      if (i != 39) dataResponse += ",";
    }
  }
  dataResponse += "],";

  dataResponse += "\"l\":[";  //l for LCD value
  for (byte i = 0; i <= lcdSize - 1; i++) {
    dataResponse += "\"";
    dataResponse += lcd[i];
    dataResponse += "\"";
    if (i != lcdSize - 1) dataResponse += ",";
  }
  dataResponse += "],";
  dataResponse += "\"t\":\"";  //t for Board Type .
  dataResponse += boardType;
  dataResponse += "\",";
  dataResponse += "\"p\":\"";  // p for Password.
  dataResponse += protectionPassword;
  dataResponse += "\"";
  dataResponse += "}";
  client.print(dataResponse);
}

post the code with code tags, not as an attachment we can't read easily on our smartPhone

(please read How to get the best out of this forum and post accordingly)

Ok. I followed the code tags direction and loaded the code

Thx - is that all the compiler is saying?

Yes.

Can you compile an empty sketch for your target platform ?

Let me try quickly

The empty sketch doesn’t work either. Still getting the, Compilation error: Exit status 255

The Compilation error: Exit status 255 typically indicates a failure in the build process - so some missing files or IDE not installed correctly, missing included files or loops in the included etc

Did you install the ESP32 board package and selected the right board for compilation?

Yes.
Installed Package: esp32 by Espress Systems version 1.0.4
Selected Board: ESP32 Dev Module
Selected, Partition Scheme: Huge App(3MB No OTA / 1MB SPIFFS)

I was getting a Python error earlier today. Then I installed Python 2 and Python 3 and that went away, and now I'm only getting the "Exit Status 255 error"

Which platform are you using?
This sounds like an IDE install issue

This feels outdated

Did you set the board package to be

https://espressif.github.io/arduino-esp32/package_esp32_index.json

https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html

I just installed the board package you recommended. Thanks. Now I'm questioning if I selected the right board in Arduino. Currently I have selected "ESP32 Dev Module.

Not sure how to find the right board - I pasted a link to the ESP32 Servo board I have. Can you tell me what board I should be selecting in Arduino ?

Read their wiki - it’s not your typical Arduino it seems … (I don’t know that one)

They say

How to Use

ESP32 Flash Download Tool

Generally, we control the ST series servos by compiling and uploading the demo through the Arduino IDE. However, compiling through Arduino requires installing various dependency libraries before use. Therefore, we provide an ESP32 download tool. With this tool, users can download the demo to the driver board without needing to download other dependency libraries or the Arduino IDE software.

  • Click here to download ESP32 Flash Download Tool. Once downloaded, extract the files and double-click on the "flash_download_tool_3.9.5.exe" program. After opening, two windows will appear. The UI interface of the download tool is the one you need to operate, while the other window serves as a terminal to display the working status of the download tool.
  • In the "DOWNLOAD TOOL MODE" interface, select Chip Type as ESP32 and WorkMode as Factory. When using Factory to call the binary file, it will use a relative path, eliminating the need for users to manually input the binary file path. After making these selections, click OK.

This is great news. Thanks, I just downloaded the software. Give me a few minutes and I'll let you know where I am in the process

I'm using a Mac. Trying to file an app to open the exe file

They might have just a windows version…

Ok. I installed cross over and the exe file opened up and I'm now I see a screen that lets me activate servos connected to the ESP32. I connected the ESP32 servo board to my computer but it's not communicating while hardwired. Not sure what to do at this point to operate the board wirelessly. Can you help ?

I don’t have that board and never heard about it before you brought that up…

It seems very specific, did you download and explored their zip SCSTServoLibrary

https://files.waveshare.com/upload/2/22/SCSTServoLibrary.zip