Help with errors compiling DomeController.ino

Hello good morning, I introduce myself, I am new and I do not have much or no idea about programming. My intention is to use a program already made for the computerization of a dome of an astronomical observatory. It gives me an error and I don't know how to act. Excuse my great ignorance.
I copy the error line that shows me in the arduino programmer when verifying and setting the programming code apart.
Thanks in advance!!!

I attach the document because the code is extensive

ERROR:

Arduino:1.8.13 (Windows 10), Tarjeta:"Arduino Uno"

In file included from C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino:5:0:

C:\Users\domin\OneDrive\Documentos\Arduino\libraries\SerialCommands\src/SerialCommands.h:42:80: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

SerialCommands(Stream* serial, char* buffer, int16_t buffer_len, char* term = "\r\n", char* delim = " ") :

^~~~~~

C:\Users\domin\OneDrive\Documentos\Arduino\libraries\SerialCommands\src/SerialCommands.h:42:102: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

SerialCommands(Stream* serial, char* buffer, int16_t buffer_len, char* term = "\r\n", char* delim = " ") :

^~~

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino:101:1: warning: declaration does not declare anything [-fpermissive]

SerialCommands ;

^~~~~~~~~~~~~~

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino: In function 'void cmdAbort(uint8_t*)':

sketch_aug05a:246:21: error: 'START' was not declared in this scope

uint8_t resp[] = {START, 2, TO_COMPUTER | ABORT_CMD, 0x00};

^~~~~

sketch_aug05a:247:3: error: 'sCmd' was not declared in this scope

sCmd.sendResponse(resp, 4);

^~~~

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino:247:3: note: suggested alternative: 'cmd'

sCmd.sendResponse(resp, 4);

^~~~

cmd

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino: In function 'void cmdHomeAzimuth(uint8_t*)':

sketch_aug05a:257:21: error: 'START' was not declared in this scope

uint8_t resp[] = {START, 3, TO_COMPUTER | HOME_CMD, 0x01, 0x00};

^~~~~

sketch_aug05a:258:3: error: 'sCmd' was not declared in this scope

sCmd.sendResponse(resp, 5);

^~~~

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino:258:3: note: suggested alternative: 'cmd'

sCmd.sendResponse(resp, 5);

^~~~

cmd

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino: In function 'void cmdGotoAzimuth(uint8_t*)':

sketch_aug05a:269:21: error: 'START' was not declared in this scope

uint8_t resp[] = {START, 3, TO_COMPUTER | GOTO_CMD, 0x01, 0x00};

^~~~~

sketch_aug05a:270:3: error: 'sCmd' was not declared in this scope

sCmd.sendResponse(resp, 5);

^~~~

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino:270:3: note: suggested alternative: 'cmd'

sCmd.sendResponse(resp, 5);

^~~~

cmd

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino: In function 'void cmdShutterCommand(uint8_t*)':

sketch_aug05a:305:21: error: 'START' was not declared in this scope

uint8_t resp[] = {START, 2, TO_COMPUTER | SHUTTER_CMD, 0x00};

^~~~~

sketch_aug05a:306:3: error: 'sCmd' was not declared in this scope

sCmd.sendResponse(resp, 4);

^~~~

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino:306:3: note: suggested alternative: 'cmd'

sCmd.sendResponse(resp, 4);

^~~~

cmd

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino: In function 'void cmdStatus(uint8_t*)':

sketch_aug05a:324:21: error: 'START' was not declared in this scope

uint8_t resp[] = {START, 9, TO_COMPUTER | STATUS_CMD, sh_status, az_status,

^~~~~

sketch_aug05a:331:3: error: 'sCmd' was not declared in this scope

sCmd.sendResponse(resp, 11);

^~~~

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino:331:3: note: suggested alternative: 'cmd'

sCmd.sendResponse(resp, 11);

^~~~

cmd

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino: In function 'void cmdSetPark(uint8_t*)':

sketch_aug05a:342:21: error: 'START' was not declared in this scope

uint8_t resp[] = {START, 2, TO_COMPUTER | SETPARK_CMD, 0x00};

^~~~~

sketch_aug05a:343:3: error: 'sCmd' was not declared in this scope

sCmd.sendResponse(resp, 4);

^~~~

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino:343:3: note: suggested alternative: 'cmd'

sCmd.sendResponse(resp, 4);

^~~~

cmd

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino: In function 'void cmdSetTicks(uint8_t*)':

sketch_aug05a:351:21: error: 'START' was not declared in this scope

uint8_t resp[] = {START, 2, TO_COMPUTER | TICKS_CMD, 0x00};

^~~~~

sketch_aug05a:352:3: error: 'sCmd' was not declared in this scope

sCmd.sendResponse(resp, 4);

^~~~

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino:352:3: note: suggested alternative: 'cmd'

sCmd.sendResponse(resp, 4);

^~~~

cmd

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino: In function 'void cmdVBat(uint8_t*)':

sketch_aug05a:357:21: error: 'START' was not declared in this scope

uint8_t resp[] = {START, 4, TO_COMPUTER | VBAT_CMD, 0x00, 0x00, 0x00};

^~~~~

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino:360:29: warning: expression list treated as compound expression in initializer [-fpermissive]

int ToBytes(vbat, resp + 3);

^

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino:360:29: warning: invalid conversion from 'uint8_t* {aka unsigned char*}' to 'int' [-fpermissive]

sketch_aug05a:362:3: error: 'sCmd' was not declared in this scope

sCmd.sendResponse(resp, 6);

^~~~

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino:362:3: note: suggested alternative: 'cmd'

sCmd.sendResponse(resp, 6);

^~~~

cmd

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino: In function 'void cmdAck(uint8_t*)':

sketch_aug05a:367:21: error: 'START' was not declared in this scope

uint8_t resp[] = {START, 3, TO_COMPUTER | ACK_CMD, 0x03, 0x00};

^~~~~

sketch_aug05a:370:3: error: 'sCmd' was not declared in this scope

sCmd.sendResponse(resp, 5);

^~~~

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino:370:3: note: suggested alternative: 'cmd'

sCmd.sendResponse(resp, 5);

^~~~

cmd

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino: In function 'void setup()':

sketch_aug05a:478:3: error: 'sCmd' was not declared in this scope

sCmd.addCommand(ABORT_CMD, 2, cmdAbort);

^~~~

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino: In function 'void loop()':

sketch_aug05a:508:3: error: 'sCmd' was not declared in this scope

sCmd.readSerial();

^~~~

C:\Users\domin\OneDrive\Documentos\Arduino\programa\sketch_aug05a\sketch_aug05a.ino: At global scope:

sketch_aug05a:512:1: error: expected declaration before '}' token

}

^

Se encontraron varias bibliotecas para "SerialCommands.h"

Usado: C:\Users\domin\OneDrive\Documentos\Arduino\libraries\SerialCommands

No usado: C:\Users\domin\OneDrive\Documentos\Arduino\libraries\SerialCommands_ID1976

exit status 1

'START' was not declared in this scope

sketch_aug05a.ino (12 KB)

From here I extracted the controller

Posting the link to the source code is a big help.

However when I tried to compile DomeController.ino I got different error messages from what you got - perhaps because I am using IDE 1.8.6.

My C++ is not good enough to figure out the cause of the errors I see and I suspect they are irrelevant as your errors are different.

I suspect it would help if you edit your Original Post and change your Title to something in English. People may assume that your description is also in Spanish. Perhaps the Title could be "Help with errors compiling DomeController.ino"

...R

My fault about the initial text, I can not edit the publication. If a moderator did it, it would be of great help.
The code is attached as it exceeds the maximum number of characters per post. Look at the end of the first publication attachment, it also includes a link where everything related to programming is.

#include <EEPROM.h>
#include <avr/wdt.h>
#include <SoftwareSerial.h>
//#include <Serial_command.h>
#include <SerialCommands.h>
//#include <SerialConfigCommand.h>


#define BAUDRATE 19200
#define HAS_SHUTTER     // Comment if the shutter controller is not available

// pin definitions
#define HC12_RX 4       // Recieve Pin on HC12
#define HC12_TX 5       // Transmit Pin on HC12
#define ENCODER1 2      // Azimuth encoder
#define ENCODER2 3      // Azimuth encoder
#define MOTOR_JOG 7     // Motor jog mode (low speed)
#define MOTOR_CW 8      // Move motor clockwise
#define MOTOR_CCW 9     // Move motor counterclockwise
#define HALL_PROBE 10   // Home probe

// Message Destination
#define TO_MAXDOME  0x00
#define TO_COMPUTER 0x80

#define VBAT_FACTOR (5.0/1024.0)
#define VBAT_OFFSET 10.55

// Commands
#define ABORT_CMD   0x03 // Abort azimuth movement
#define HOME_CMD    0x04 // Move until 'home' position is detected
#define GOTO_CMD    0x05 // Go to azimuth position
#define SHUTTER_CMD 0x06 // Send a command to shutter
#define STATUS_CMD  0x07 // Retrieve status
#define TICKS_CMD   0x09 // Set the number of tick per revolution of the dome
#define ACK_CMD     0x0A // ACK (?)
#define SETPARK_CMD 0x0B // Set park coordinates and shutter closing policy
#define VBAT_CMD    0x0C // Read shutter's battery voltage

// Shutter commands
#define OPEN_SHUTTER            0x01
#define OPEN_UPPER_ONLY_SHUTTER 0x02
#define CLOSE_SHUTTER           0x03
#define EXIT_SHUTTER            0x04 // Command sent to shutter on program exit
#define ABORT_SHUTTER           0x07

#define DIR_CW  0x01
#define DIR_CCW 0x02

#define AZ_TOLERANCE    4       // Azimuth target tolerance in encoder ticks
#define AZ_SLOW_RANGE   16      //
#define AZ_TIMEOUT      30000   // Azimuth movement timeout (in ms)

// EEPROM addresses
#define ADDR_PARK_POS           0
#define ADDR_TICKS_PER_TURN     2
#define ADDR_PARK_ON_SHUTTER    4


enum MotorSpeed { MOTOR_STOP, MOTOR_SLOW, MOTOR_FAST };

enum AzimuthEvent {
  EVT_NONE,
  EVT_GOTO,
  EVT_HOME,
  EVT_ABORT
};

enum AzimuthStatus {
  ST_IDLE,
  ST_GOING,
  ST_GOING_SLOW,
  ST_HOMING,
  ST_ERROR,
};

// MaxDome II azimuth status
enum MDAzimuthStatus {
  AS_IDLE = 1,
  AS_MOVING_CW,
  AS_MOVING_CCW,
  AS_IDLE2,
  AS_ERROR
};

// MaxDome II shutter status
enum ShutterStatus {
  SS_CLOSED = 0,
  SS_OPENING,
  SS_OPEN,
  SS_CLOSING,
  SS_ABORTED,
  SS_ERROR
};


#ifdef HAS_SHUTTER
SoftwareSerial HC12(HC12_TX, HC12_RX); // Create Software Serial Port
#endif
//SerialConfigCommand Cmd
SerialCommands ;

bool park_on_shutter = false;
bool home_reached = false;
bool parking = false;
uint8_t current_dir = DIR_CW;   // Current azimuth movement direction
uint16_t park_pos = 0;          // Parking position
uint16_t current_pos = 0;       // Current dome position
uint16_t target_pos = 0;        // Target dome position
uint16_t home_pos = 0;          // Home position
uint16_t ticks_per_turn = 360;  // Encoder ticks per dome revolution
AzimuthStatus state = ST_IDLE;
AzimuthEvent az_event = EVT_NONE;


// Convert two bytes to a uint16_t value (big endian)
uint16_t bytesToInt(uint8_t *data) {
  uint16_t value1 = data[1];
  uint16_t value2 = data[0];
  return (value1 & 0xff) | ((value2 << 8) & 0xff00);
}

// Convert a uint16_t value to bytes (big endian)
void intToBytes(uint16_t value, uint8_t *data) {
  data[1] = value & 0xff;
  data[0] = (value >> 8) & 0xff;
}

// Read a uint16_t value from EEPROM (little endian)
uint16_t eepromReadUint16(int address)
{
  uint16_t value1 = EEPROM.read(address);
  uint16_t value2 = EEPROM.read(address + 1);
  return (value1 & 0xff) | ((value2 << 8) & 0xff00);
}

// Read a uint16_t value from EEPROM (little endian)
void eepromWriteUint16(int address, uint16_t value)
{
  uint8_t value1 = value & 0xff;
  uint8_t value2 = (value >> 8) & 0xff;
  EEPROM.write(address, value1);
  EEPROM.write(address + 1, value2);
}


// Obtain the direction of the shortest path between two positons
uint8_t getDirection(uint16_t current, uint16_t target)
{
  if (target > current)
    return ((target - current) > ticks_per_turn / 2) ? DIR_CCW : DIR_CW;

  return ((current - target) > ticks_per_turn / 2) ? DIR_CW : DIR_CCW;
}

// Obtain the distance between two positons
uint16_t getDistance(uint16_t current, uint16_t target)
{
  // obtain the absolute value of the difference
  uint16_t diff = (target > current) ?  target - current : current - target;

  if (diff > ticks_per_turn / 2)
    return ticks_per_turn - diff;

  return diff;
}

inline void moveAzimuth(uint8_t dir)
{
  digitalWrite(MOTOR_CW, dir == DIR_CW);
  digitalWrite(MOTOR_CCW, dir != DIR_CW);
}

inline void stopAzimuth()
{
  digitalWrite(MOTOR_JOG, LOW);
  digitalWrite(MOTOR_CW, LOW);
  digitalWrite(MOTOR_CCW, LOW);
}

inline void setJog(bool enable)
{
  digitalWrite(MOTOR_JOG, enable);
}

float getShutterVBat() {
  int adc = 0;

#ifdef HAS_SHUTTER
  char buffer[5];

  HC12.flush();
  for (int i = 0; i < 4; i++) {
    HC12.println("vbat");
    delay(100);

    if (HC12.read() == 'v') {
      for (int j = 0; j < 4; j++) {
        buffer[j] = HC12.read();
      }

      buffer[4] = 0;
      adc = atoi(buffer);
      break;
    }
  }
#endif

  // Convert ADC reading to voltage
  return (float)adc * VBAT_FACTOR + VBAT_OFFSET;
}

ShutterStatus getShutterStatus() {
  ShutterStatus st = SS_OPEN;

#ifdef HAS_SHUTTER
  st = SS_ERROR;
  HC12.flush();
  for (int i = 0; i < 4; i++) {
    HC12.println("stat");
    delay(100);

    char c = 0;
    while (HC12.available() > 0) {
      c = HC12.read();
    }

    if (c >= '0' && c <= ('0' + SS_ERROR)) {
      st = (ShutterStatus)(c - '0');
      break;
    }
  }
#endif
  return st;
}


void cmdAbort(uint8_t *cmd)
{
#ifdef HAS_SHUTTER
  HC12.println("abort");  // abort shutter movement
#endif

  az_event = EVT_ABORT;

  uint8_t resp[] = {START, 2, TO_COMPUTER | ABORT_CMD, 0x00};
  sCmd.sendResponse(resp, 4);
}

void cmdHomeAzimuth(uint8_t *cmd)
{
  if (!parking) {
    current_dir = getDirection(current_pos, 0);
    az_event = EVT_HOME;
  }

  uint8_t resp[] = {START, 3, TO_COMPUTER | HOME_CMD, 0x01, 0x00};
  sCmd.sendResponse(resp, 5);
}

void cmdGotoAzimuth(uint8_t *cmd)
{
  if (!parking) {
    current_dir = cmd[3];
    target_pos = bytesToInt(cmd + 4);
    az_event = EVT_GOTO;
  }

  uint8_t resp[] = {START, 3, TO_COMPUTER | GOTO_CMD, 0x01, 0x00};
  sCmd.sendResponse(resp, 5);
}

void parkDome()
{
  parking = true;
  target_pos = park_pos;
  az_event = EVT_GOTO;

domingo_perez:
My fault about the initial text, I can not edit the publication.

You should be able to edit it. Just go to your Original Post and click the More/Modify button at the bottom right

Is the program in Reply #4 identical to the program on the Github site?

If not then, first things first, does the Github program compile correctly? There is no point going further if it does not. You need to figure that out first.

Then, if you have made changes to the Github program what are they?

...R

}

void cmdShutterCommand(uint8_t *cmd)
{
#ifdef HAS_SHUTTER
 switch (cmd[3]) {
   case OPEN_SHUTTER:
     HC12.println("open");
     break;
   case OPEN_UPPER_ONLY_SHUTTER:
     HC12.println("open1");
     break;
   case CLOSE_SHUTTER:
     if (park_on_shutter)
       parkDome();
     else
       HC12.println("close");
     break;
   case EXIT_SHUTTER:
     HC12.println("exit");
     break;
   case ABORT_SHUTTER:
     HC12.println("abort");
     break;
 }
#endif

 uint8_t resp[] = {START, 2, TO_COMPUTER | SHUTTER_CMD, 0x00};
 sCmd.sendResponse(resp, 4);
}

void cmdStatus(uint8_t *cmd)
{
 MDAzimuthStatus az_status;
 if (state == ST_IDLE) {
   az_status = AS_IDLE;
 } else if (state == ST_ERROR) {
   az_status = AS_ERROR;
 } else {
   if (current_dir == DIR_CW)
     az_status = AS_MOVING_CW;
   else
     az_status = AS_MOVING_CCW;
 }

 uint8_t sh_status = (uint8_t)getShutterStatus();
 uint8_t resp[] = {START, 9, TO_COMPUTER | STATUS_CMD, sh_status, az_status,
                   0x00, 0x00, 0x00, 0x00, 0x00, 0x00
                  };

 intToBytes(current_pos, resp + 5);
 intToBytes(home_pos, resp + 7);

 sCmd.sendResponse(resp, 11);
}

void cmdSetPark(uint8_t *cmd)
{
 park_on_shutter = cmd[3];
 park_pos = bytesToInt(cmd + 4);

 EEPROM.write(ADDR_PARK_ON_SHUTTER, park_on_shutter);
 eepromWriteUint16(ADDR_PARK_POS, park_pos);

 uint8_t resp[] = {START, 2, TO_COMPUTER | SETPARK_CMD, 0x00};
 sCmd.sendResponse(resp, 4);
}

void cmdSetTicks(uint8_t *cmd)
{
 ticks_per_turn = bytesToInt(cmd + 3);
 eepromWriteUint16(ADDR_TICKS_PER_TURN, ticks_per_turn);

 uint8_t resp[] = {START, 2, TO_COMPUTER | TICKS_CMD, 0x00};
 sCmd.sendResponse(resp, 4);
}

void cmdVBat(uint8_t *cmd)
{
 uint8_t resp[] = {START, 4, TO_COMPUTER | VBAT_CMD, 0x00, 0x00, 0x00};

 int vbat = getShutterVBat() * 100;
 int ToBytes(vbat, resp + 3);

 sCmd.sendResponse(resp, 6);
}

void cmdAck(uint8_t *cmd)
{
 uint8_t resp[] = {START, 3, TO_COMPUTER | ACK_CMD, 0x03, 0x00};
 

 sCmd.sendResponse(resp, 5);
}

void updateAzimuthFSM()
{
 static unsigned long t0;

 switch (state) {
   case ST_HOMING:
     if (az_event == EVT_ABORT) {
       parking = false;
       stopAzimuth();
       state = ST_IDLE;
     } else if (home_reached) {
       stopAzimuth();
       state = ST_IDLE;
       home_reached = false;
     } else if (millis() - t0 > AZ_TIMEOUT) {
       stopAzimuth();
       state = ST_ERROR;
     }
     break;

   case ST_GOING:
     if (az_event == EVT_ABORT) {
       parking = false;
       stopAzimuth();
       state = ST_IDLE;
     } else if (getDistance(current_pos, target_pos) < AZ_SLOW_RANGE) {
       moveAzimuth(current_dir);
       setJog(true);
       state = ST_GOING_SLOW;
     } else if (millis() - t0 > AZ_TIMEOUT) {
       stopAzimuth();
       state = ST_ERROR;
     }
     break;

   case ST_GOING_SLOW:
     if (az_event == EVT_ABORT) {
       parking = false;
       stopAzimuth();
       state = ST_IDLE;
     } else if (getDistance(current_pos, target_pos) < AZ_TOLERANCE) {
       stopAzimuth();

       // close shutter after parking
       if (parking) {
         parking = false;
#ifdef HAS_SHUTTER
         HC12.println("close");
#endif
       }

       state = ST_IDLE;
     } else if (millis() - t0 > AZ_TIMEOUT) {
       stopAzimuth();
       state = ST_ERROR;
     }
     break;

   case ST_ERROR:
   case ST_IDLE:
     if (az_event == EVT_HOME) {
       t0 = millis();
       state = ST_HOMING;
       moveAzimuth(current_dir);
     } else if (az_event == EVT_GOTO) {
       t0 = millis();
       state = ST_GOING;
       moveAzimuth(current_dir);
     }
     break;
 }
 az_event = EVT_NONE;
}

// Encoder interrupt service routine
void encoderISR()
{
 if (digitalRead(ENCODER1) == digitalRead(ENCODER2)) {
   if (current_pos == 0)
     current_pos = ticks_per_turn - 1;
   else
     current_pos--;
 } else {
   if (current_pos >= ticks_per_turn)
     current_pos = 0;
   else
     current_pos++;
 }

 // store detected home position
 if (!digitalRead(HALL_PROBE)) {
   if (state == ST_HOMING) {
     home_pos = 0;
     current_pos = 0;
     home_reached = true;
   } else
     home_pos = current_pos;
 }
}

void setup()
{
 wdt_disable();
 wdt_enable(WDTO_2S);

 sCmd.addCommand(ABORT_CMD, 2, cmdAbort);
 sCmd.addCommand(HOME_CMD, 2, cmdHomeAzimuth);
 sCmd.addCommand(GOTO_CMD, 5, cmdGotoAzimuth);
 sCmd.addCommand(SHUTTER_CMD, 3, cmdShutterCommand);
 sCmd.addCommand(STATUS_CMD, 2, cmdStatus);
 sCmd.addCommand(SETPARK_CMD, 5, cmdSetPark);
 sCmd.addCommand(TICKS_CMD, 4, cmdSetTicks);
 sCmd.addCommand(ACK_CMD, 2, cmdAck);
 sCmd.addCommand(VBAT_CMD, 2, cmdVBat);

 pinMode(LED_BUILTIN, OUTPUT);
 pinMode(MOTOR_JOG, OUTPUT);
 pinMode(MOTOR_CW, OUTPUT);
 pinMode(MOTOR_CCW, OUTPUT);

 attachInterrupt(digitalPinToInterrupt(ENCODER1), encoderISR, CHANGE);

 park_pos = eepromReadUint16(ADDR_PARK_POS);
 park_on_shutter = EEPROM.read(ADDR_PARK_ON_SHUTTER);
 ticks_per_turn = eepromReadUint16(ADDR_TICKS_PER_TURN);

 Serial.begin(19200);
#ifdef HAS_SHUTTER
 HC12.begin(9600);   // Open serial port to HC12
#endif
}


void loop()
{
 sCmd.readSerial();
 updateAzimuthFSM();
 wdt_reset();
}
}

I expose the code in two parts

I have not made any changes, the only thing I did was include a library because the android programmer could not find the library #include <SerialCommands.h>. If I have to perform the test with another program other than Arduino then clearly there is the error.

domingo_perez:
I have not made any changes, the only thing I did was include a library because the android programmer could not find the library #include <SerialCommands.h>. If I have to perform the test with another program other than Arduino then clearly there is the error.

If you download the code from Github as a ZIP file and extract the contents then the folder called DomeController will have the files DomeController.ino, serial_command.h and serial_command.cpp. And the file DomeController.ino will have the correct code
#include "serial_command.h"
for the serial_command file.

...R

I have found the correct code for the dome control mode, but for the gate mode I get exactly the above problem. Import the command library to the folder but the problem is not solved.

Error:

In file included from C:\Users\domin\OneDrive\Escritorio\ArduinoDomeController-master\DomeShutter\DomeShutter.ino:32:0:

C:\Users\domin\OneDrive\Documentos\Arduino\libraries\SerialCommands\src/SerialCommands.h:42:80: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

SerialCommands(Stream* serial, char* buffer, int16_t buffer_len, char* term = "\r\n", char* delim = " ") :

^~~~~~

C:\Users\domin\OneDrive\Documentos\Arduino\libraries\SerialCommands\src/SerialCommands.h:42:102: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

SerialCommands(Stream* serial, char* buffer, int16_t buffer_len, char* term = "\r\n", char* delim = " ") :

^~~

DomeShutter:77:15: error: no matching function for call to 'SerialCommand::SerialCommand()'

SerialCommand sCmd;

^~~~

In file included from C:\Users\domin\OneDrive\Escritorio\ArduinoDomeController-master\DomeShutter\DomeShutter.ino:32:0:

C:\Users\domin\OneDrive\Documentos\Arduino\libraries\SerialCommands\src/SerialCommands.h:27:2: note: candidate: SerialCommand::SerialCommand(const char*, void ()(SerialCommands))

SerialCommand(const char* cmd, void(func)(SerialCommands))

^~~~~~~~~~~~~

C:\Users\domin\OneDrive\Documentos\Arduino\libraries\SerialCommands\src/SerialCommands.h:27:2: note: candidate expects 2 arguments, 0 provided

C:\Users\domin\OneDrive\Documentos\Arduino\libraries\SerialCommands\src/SerialCommands.h:24:7: note: candidate: constexpr SerialCommand::SerialCommand(const SerialCommand&)

class SerialCommand

^~~~~~~~~~~~~

C:\Users\domin\OneDrive\Documentos\Arduino\libraries\SerialCommands\src/SerialCommands.h:24:7: note: candidate expects 1 argument, 0 provided

C:\Users\domin\OneDrive\Documentos\Arduino\libraries\SerialCommands\src/SerialCommands.h:24:7: note: candidate: constexpr SerialCommand::SerialCommand(SerialCommand&&)

C:\Users\domin\OneDrive\Documentos\Arduino\libraries\SerialCommands\src/SerialCommands.h:24:7: note: candidate expects 1 argument, 0 provided

C:\Users\domin\OneDrive\Escritorio\ArduinoDomeController-master\DomeShutter\DomeShutter.ino: In function 'void setup()':

DomeShutter:172:10: error: 'SerialCommand {aka class SerialCommand}' has no member named 'addCommand'; did you mean 'command'?

sCmd.addCommand("open", cmdOpenBoth);

^~~~~~~~~~

command

DomeShutter:173:10: error: 'SerialCommand {aka class SerialCommand}' has no member named 'addCommand'; did you mean 'command'?

sCmd.addCommand("open1", cmdOpenShutter);

^~~~~~~~~~

command

DomeShutter:174:10: error: 'SerialCommand {aka class SerialCommand}' has no member named 'addCommand'; did you mean 'command'?

sCmd.addCommand("close", cmdClose);

^~~~~~~~~~

command

DomeShutter:175:10: error: 'SerialCommand {aka class SerialCommand}' has no member named 'addCommand'; did you mean 'command'?

sCmd.addCommand("abort", cmdAbort);

^~~~~~~~~~

command

DomeShutter:176:10: error: 'SerialCommand {aka class SerialCommand}' has no member named 'addCommand'; did you mean 'command'?

sCmd.addCommand("exit", cmdExit);

^~~~~~~~~~

command

DomeShutter:177:10: error: 'SerialCommand {aka class SerialCommand}' has no member named 'addCommand'; did you mean 'command'?

sCmd.addCommand("stat", cmdStatus);

^~~~~~~~~~

command

DomeShutter:178:10: error: 'SerialCommand {aka class SerialCommand}' has no member named 'addCommand'; did you mean 'command'?

sCmd.addCommand("vbat", cmdGetVBat);

^~~~~~~~~~

command

C:\Users\domin\OneDrive\Escritorio\ArduinoDomeController-master\DomeShutter\DomeShutter.ino: In function 'void loop()':

DomeShutter:231:10: error: 'SerialCommand {aka class SerialCommand}' has no member named 'readSerial'

sCmd.readSerial();

^~~~~~~~~~

Se encontraron varias bibliotecas para "SerialCommands.h"

Usado: C:\Users\domin\OneDrive\Documentos\Arduino\libraries\SerialCommands

No usado: C:\Users\domin\OneDrive\Documentos\Arduino\libraries\SerialCommands_ID1976

exit status 1

no matching function for call to 'SerialCommand::SerialCommand()'

This is the serialcommands code that was edited by its creator. When attaching your libraries to the arduino folders, the above error does not appear but it gives me another error:

exit status 1
redefinition of 'class SerialCommand'

/******************************************************************
    Author:     Juan Menendez Blanco    <juanmb@gmail.com>

    This code is part of the ArduinoDomeController project:
        https://github.com/juanmb/ArduinoDomeController

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

#ifndef _SerialCommand_h_
#define _SerialCommand_h_

#include <inttypes.h>

#define MAX_CMD_SIZE 32
#define MAX_COMMANDS 16

#define START 0x01  // Start byte


typedef void (* cbFunction)(uint8_t*);


typedef struct commandCallback {
    uint8_t id;
    uint8_t size;
    cbFunction function;
} commandCallback;


class SerialCommand {
public:
    SerialCommand();
    void readSerial();
    void sendResponse(uint8_t *, uint8_t);
    int addCommand(const uint8_t, uint8_t, cbFunction);
private:
    uint8_t getCRC(uint8_t*, uint8_t);
    commandCallback commandList[MAX_COMMANDS];
    uint8_t buffer[MAX_CMD_SIZE];
    cbFunction cmdFunction;
    int nCommands;
    int cmdSize;
    int bufPos;
};

#endif