arduino manager

having problems with analogy read I have a potentiometer wired to a0 on mega and led on pin
on the ipad Arduino manager I have a switch widget named led d2 this switches the led on and of and works perfect .
and I have a gauge called pot0 widget to read the input from a0 but this will not work

can anyone help ? thankyou for taking the time to look

/**
 * This file has been generated with Arduino Manager for iPhone/iPad version: 10.1
 *
 * https://itunes.apple.com/it/app/arduino-manager/id497240094?l=en&mt=8
 *
 * For more information write to fabboco@gmail.com
 **/
#include <RBL_nRF8001.h>
#include <SPI.h>
#include <boards.h>
#include <IOSControllerBLE.h>

#define Led_2_PIN			2

/* Start your code (defines) */
/* End your code */

/*
 *
 * IOSController Library initialization
 *
 */

IOSControllerBLE iosController(&doWork,&doSync,&processIncomingMessages,&processOutgoingMessages,&deviceConnected,&deviceDisconnected);

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

float Pot0;


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

void setup()
{  
  ble_begin();
  
  Serial.begin(115200);

  pinMode(4,OUTPUT);
  digitalWrite(4,HIGH);
  pinMode(53,OUTPUT);
  digitalWrite(53,LOW);

  pinMode(Led_2_PIN,OUTPUT);
  digitalWrite(Led_2_PIN,HIGH);


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

void loop() {  
  
  iosController.loop();
}

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


  /* Start your code (doWork) */
  /* 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) {


  if(strcmp(variable,"Led 2")==0) {

    switchLed_2SyncCallback();
  }


  /* Start your code (doSync) */
  /* 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,"Led 2")==0) {

    switchLed_2Callback(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() {


  iosController.writeMessage("Pot0",Pot0);


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

void deviceConnected () {

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

void deviceDisconnected () {

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


/* Widgets synchronization callbacks */

void switchLed_2SyncCallback() {

  /* Start your code (switchLed_2SyncCallback) */

  //iosController.writeMessage("Led 2",Insert value here);

  /* End your code */

  iosController.writeMessage("Led_2",digitalRead(Led_2_PIN));
}


/* Widgets operations callbacks */

void switchLed_2Callback(boolean on) {

  /* Start your code (switchLed_2Callback) */
  /* End your code */

  digitalWrite(Led_2_PIN,on);
}



/* Analog input preprocess functions */



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

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

maddave wrote (in part):

having problems with analogy read I have a potentiometer wired to a0 on mega

but a potentiometer has three terminals, so this does not really describe the wiring. Please provide a sketch or diagram or schematic or something of the real wiring.

maddave wrote (in part):

led on pin

I do not know what this even means, but the code suggests that the LED is on pin 2.

I do not know "the ipad Arduino manager" so I cannot really help, but I suspect the wiring if the "pot0 widget to read the input from a0 but this will not work ".

sorry should say led on d2 pin

I missed the mention of the A0 pin in the code, where is it?