Is my code correct?       ~Thanks

"this code is suppose to take a input of <=5v analog voltage and convert it to digital in order to show on the screen how much voltage is left"
"is the code correct???? PLEASE HELP"

//Analog to Digital Voltage

const int anPin = 1; //sets pin 1 as analog reader
long anVolt, hold;
float val;//value of voltage

void setup(){
pinMode(anPin, INPUT);
}

void loop(){

for(int time = 0; true ; time++){ //x needs to be a number of time
// i.e. amount of time it will take the
//battery to die
anVolt = analogRead(anPin); //reads the voltage '0v' - '5v'
hold = (float)anVolt * .004888 ; //constant 5/1023
val = (float)hold * 2.4;//for the 12 volt measurement

delay(300000); //five minutes delay then reads battery voltage again
}

Serial.print("Amount Voltage Left ");
Serial.print(val);
}

"AD"

"hold" is an integer - it should be a float, at least.

hold = (float)anVolt * .004888 ; //constant 5/1023

If "anVolt" is less than 204, then "hold" will be zero.
Or you could rearrange your arithmetic.

(Please use the Code (#) button when posting code)

cool, i changed that.. would the code work?.. also does the arduino need an output pin for the voltage to display?

if it's 204.. it would be 204*0.004888= roughly 1... then it would multiply by 2.4 which would equal 2.4 volts then that needs to show up on an lcd screen or something like that.

You could probably do with a "Serial.begin()".
Sorry, I don't have an Arduino to hand.

if it's 204.. it would be 204*0.004888= roughly 1... then it would multiply by 2.4 which would equal 2.4 volts

Yes, but it will read 2.4 volts when the actual input voltage is nearly 4.8V and so on.
You need to correct your arithmetic.

yes, the overall point of the project is to read the voltage of a 12v battery.

so what about the output? do i need to select a special pin in the "Digital" section of the arduinom?

I'm just wondering if the map() function would make this easier, and if reverse mapping could be used to show the remaining voltage?

http://www.arduino.cc/en/Reference/Map

Also, maybe print the value before waiting 5 mins.

so what about the output?

What do you want the output to do? Light an LED? Drive a bar of LEDs? Drive an analogue meter? Play a tune?

i would like it to play a tune as well as show on an lcd display

http://www.arduino.cc/playground/Main/InterfacingWithHardware#audio_libraries