a function-definition is not allowed here before '{' token

Hello please help me :)

int pin = 1; void setup() {

Serial.begin(9600);

} void loop() { float temp = (temp - .5) * 100; Serial.println(temp); delay(1); float getvoltage(int pin){ return(analogRead(pin) * .004882814); } }

ERROR:C:\Users\User\AppData\Local\Temp\arduino_modified_sketch_450312\sketch_may31a.ino: In function 'void loop()':

sketch_may31a:13: error: a function-definition is not allowed here before '{' token

float getvoltage(int pin){

^

exit status 1 a function-definition is not allowed here before '{' token

You have the 'getvoltage(int pin)' function inside of loop(). It should be outside, typically below, and in alphabetical order with other future functions.

Thank you :slight_smile: