could someone verifies this code

hi all,

the pice of code is meant to convert analog signal to digital then send it to pin D37 in due board.

#include <arduino.h>

/* DEFINES  */
#define IN_PIN A0
#define LED_PIN 37  //LED is on PIn?
#define BYTE_SIZE 12
#define TX_DELAY 16
//#define PIN_T 36
//#define DEBUG_ON

/* Global Variables  */
int Audio_inp = 0; //Input from Audio

/* Function Definitions  */
void Output_Data(int);

void setup()
{
  
      REG_ADC_MR = (REG_ADC_MR & 0xFFF0FFFF) | 0x00020000;// to fast the analog read function
      
  
	#ifdef DEBUG_ON
	
		 Serial.begin(9600);
		 
	#endif
	pinMode (IN_PIN,INPUT);
	pinMode(LED_PIN, OUTPUT);

        digitalWrite(LED_PIN, LOW);   //OFF
     
        analogReadResolution(BYTE_SIZE);
}




/* Function : Output byte to the Signal signal
     */
void Output_Data(int val)
{
   short aux = BYTE_SIZE;
     	  #ifdef DEBUG_ON
	   
	
		 
	   #endif

   while(aux > 0)
   {
     if( (val & (1 << (aux-1)))) // We check each bit from LSB to MSB
     {
       digitalWrite(LED_PIN, HIGH);  //ON
	   
	   #ifdef DEBUG_ON
	   
	    Serial.println ("high");
		 
	  #endif
		
     }
     else
     {
       digitalWrite(LED_PIN, LOW);   //OFF
	   
	   #ifdef DEBUG_ON
	   
	     Serial.println ("low");
		 
	   #endif
     }
     
     aux--;
     delayMicroseconds(TX_DELAY);
   }
}


void loop()
{
  #ifdef DEBUG_ON
 /* unsigned long start, stop_time;
  
  
  start =  micros();
  Audio_inp = analogRead(A0);
  stop_time = micros();
  
  Serial.println(stop_time - start);*/
  #endif
  
   Audio_inp = analogRead(IN_PIN);
  if(Audio_inp < 0)
  {
      Audio_inp = 0;
  }

   
   
   


   
   
   Output_Data(Audio_inp);
  
       	  #ifdef DEBUG_ON
	   
	
		 
	   #endif

}

could someone help me out, becose i am getting oupt in pin d37 even analog input pin isn't connected. beside i can't see the any output in Serial window neither.

any help would be greatly appreciated,

regards,

M,

Just because the analog pin isn't connected, doesn't mean it won't have a value.

Edit... in fact the reference page for analogRead says:

If the analog input pin is not connected to anything, the value returned by analogRead() will fluctuate based on a number of factors (e.g. the values of the other analog inputs, how close your hand is to the board, etc.).