Hi everyone
Just got my very first arduino starter pack and it has been great fun the past few hours.
When going through the lessons there is one part I didn't quite understand and not sure what to search to find some answer, so I was hoping I could get some help here with a really newbie question.
As I understand it, getVoltage(temperaturePin) does analogRead on pin 0.
Further down in the it says
float getVoltage(int pin) and
return (analogRead(pin) * 0.004882814);
But I can't see the parameter "pin" itself contains anything, what does it do?
const int temperaturePin = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
float voltage, degreesC, degreesF;
voltage = getVoltage(temperaturePin);
degreesC = (voltage - 0.5) * 100.0;
degreesF = degreesC * (9.0/5.0) + 32.0;
Serial.print("voltage: ");
Serial.print(voltage);
Serial.print(" deg C: ");
Serial.print(degreesC);
Serial.print(" deg F: ");
Serial.println(degreesF);
delay(1000); // repeat once per second (change as you wish!)
}
float getVoltage(int pin)
{
return (analogRead(pin) * 0.004882814);
}