error convert int to const char

This is the line giving me trouble:

steerServoPos = map(atoi(value), 0, 1023, 90, 180);

Which is part of:

#include <SPI.h>
#include <Ethernet.h>
#include <SD.h>
#include <IOSController.h>

/* Start your code (defines) */

#include<Servo.h>

//Declare Servos
Servo steerservo;    //steering servo
Servo throttleservo;   //drive servo
const int steerservopin=22;  //pin number for steering servo
const int throttleservopin=24;  //pin number for throttle servo
int throttleServoPos;
int steerServoPos;
#define CHIPSELECT 4
/* End your code */

/*
 *
 * Initialize the Ethernet server library
 */
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; 

IPAddress ip(192,168,1,145);
IPAddress gateway(192,168,1,2);
IPAddress subnet(255,255,255,0);

EthernetServer server(80);
#define CHIPSELECT 4
/*
 *
 * Prototypes of IOSController's callbacks
 *
 *
 */
void doWork();
void doSync(char *variable);
void processIncomingMessages(char *variable, char *value);
void processOutgoingMessages();
void processAlarms(char *variable);
void deviceConnected();
void deviceDisconnected();

/*
 *
 * IOSController Library initialization
 *
 */
IOSController iosController(&server,&doWork,&doSync,&processIncomingMessages,&processOutgoingMessages,&deviceConnected,&deviceDisconnected);

/******* Start Global Variable for Widgets *******/

/******* End Global Variable for Widgets *******/

void setup() {
  
  Serial.begin(9600);
  
  

  Ethernet.begin(mac, ip, subnet, gateway);  
  server.begin();

  /* Start your code (setup) */
  
  steerservo.attach(steerservopin);  // attaches the steering servo to its pin 12
  throttleservo.attach(throttleservopin);  // attaches the throttle servo to its pin 13
  
  // Servo position at 90 degrees 
 
  steerServoPos = 90;
  throttleServoPos=90;
  steerservo.write(steerServoPos);
  throttleservo.write(throttleServoPos);
  
  //delay(1000); // delay one second

  /* End your code */
}

void loop() {
  
  iosController.loop(50);// was 500
}

/**
*
*
* This function is called periodically and its equivalent to the standard loop() function
*
*/
void doWork() {



  /* Start your code (doWork) */
  
  steerservo.write(steerServoPos); 
  throttleservo.write(throttleServoPos);
  /* End your code */
}

/**
*
*
* This function is called when the ios device connects and needs to initialize the position of switches and knobs
*
*/
void doSync (char *variable) {



  /* Start your code (doSync) */
   if (strcmp(variable,"JoystickX")==0) {

    iosController.writeMessage(variable,map(steerservo.read(),0,180,0,1023));
   }

  if (strcmp(variable,"JoystickY")==0) {

    iosController.writeMessage(variable,map(throttleservo.read(),0,180,0,1023));
  }
  /* End your code */
}

/**
*
*
* This function is called when a new message is received from the iOS device
*
*/
void processIncomingMessages(char *variable, char *value) {


  if (strcmp(variable,"JoystickX") == 0) {

    if (atoi(value)>0) {

      joystickJoystickMoveRightCallback(atoi(value));
    }
    else {

      joystickJoystickMoveLeftCallback(-atoi(value));
    }
  }

  if (strcmp(variable,"JoystickY") == 0) {

    if (atoi(value)>0) {

      joystickJoystickMoveBackwardCallback(atoi(value));
    }
    else {

      joystickJoystickMoveForwardCallback(-atoi(value));
    }
  }


  /* Start your code (processIncomingMessages) */
  /* End your code */
}

/**
*
*
* This function is called periodically and messages can be sent to the iOS device
*
*/
void processOutgoingMessages() {



  /* Start your code (processOutgoingMessages) */
  /* End your code */
}

void deviceConnected () {

  /* Start your code (deviceConnected) */
  
  iosController.writeTxtMessage("Msg","Hello, I'm your Arduino board");
  
  Serial.println("Ipad Rover Device connected");
  /* End your code */
}

void deviceDisconnected () {

  /* Start your code (deviceDisconnected) */
  Serial.println("Device DISconnected");
  
  /* End your code */
}


/* Widgets synchronization callbacks */


/* Widgets operations callbacks */

void joystickJoystickMoveRightCallback(int value) {

  /* Start your code (joystickJoystickMoveRightCallback) */
steerServoPos = map(atoi(value), 0, 1023, 90, 180); 

  /* End your code */
}

void joystickJoystickMoveLeftCallback(int value) {

  /* Start your code (joystickJoystickMoveLeftCallback) */
 // Serial.print("\n JoystickX ");
// Serial.println( value );
  /* End your code */
}

void joystickJoystickMoveForwardCallback(int value) {

  /* Start your code (joystickJoystickMoveForwardCallback) */
 // Serial.print("\n JoystickY ");
// Serial.println( value );
  /* End your code */
}

void joystickJoystickMoveBackwardCallback(int value) {

  /* Start your code (joystickJoystickMoveBackwardCallback) */
  // Serial.print("\n JoystickY ");
 //Serial.println( value );
  /* End your code */
}



/**** User Functions *****/

/* Start your code (User Functions) */
/* End your code */

atoi() does NOT convert an int to a const char. It converts an const char ARRAY to an int.

So, either you misunderstood the message, misunderstood the line, or wrote the wrong thing for the title.

Given all that, you lose.

Invalid conversion from int to const char is what it says, and highlights that line. I agree that an integer is what | am looking to extract. The error code I quoted, I suppose, creates some confusion.

Here are the error lines on the compiler:

RoverIpad.ino: In function ‘void joystickJoystickMoveRightCallback(int)’:
RoverIpad:207: error: invalid conversion from ‘int’ to ‘const char*’
RoverIpad:207: error: initializing argument 1 of ‘int atoi(const char*)’

What I am trying to do is extract the value and convert it into a 90-180 integer. Not sure what I’ve done wrong, as similar code works elsewhere.

Northof49: Invalid conversion from int to const char is what it says, and highlights that line.

The error is in the following section:

void joystickJoystickMoveRightCallback(int value) {
  /* Start your code (joystickJoystickMoveRightCallback) */
  
  steerServoPos = map(atoi(value), 0, 1023, 90, 180); 

  /* End your code */
}

you're calling atoi on a value that is already defined as an integer. Hence the error.

Hope this helps,

Brad KF7FER

Thank you. My patience is getting a little thin. I haven't eaten for two days, or slept well. I'm waiting for my wife to pick me up to take me to the hospital for a minor operation and those are the surgeon's instructions. Just having some fun fooling with the arduino as I wait.