Hopefully this is a simple question. I am attempting to read voltages from analog pins. In order to change the value read during analogRead I would like to make a function to do so that returns a float of the current voltage.
What I don't know is the 'type' of the analog pins to pass as the parameter. I put what I think the function is supposed to look like below with underscores in place of the area I had a question about. Thanks in advance!
float currentVoltage(________ analogPin){
float senseValue = analogRead(analogPin);
float voltage = senseValue*(5.0/1023.0);
return voltage;
}
This line returns int value
float senseValue = analogRead(analogPin);
Leave float for the next line
float voltage = senseValue*(5.0/1023.0);
analogPin is just a byte, from 0 to 5 or 7 or 15 depending on the uC you are running in.
I hope currentVoltage is current as in "now" not current as in "amps" or it will confuse the crap out of everyone 
I thought the pins are 16-bit integers. You always type int LED_pin = 13;
Either an int or a byte will work for the function as proposed. The compiler will convert it as required.
int analogRead(uint8_t pin)
There's absolutely no difference in the machine code if senseValue is defined as an int or a float. It has to be upgraded on the next line to a float so why not make the cast to float explicit? I like the original version.
@MorganS, what voodoo is that where you got text in the bar at the top of the code box?