What I'm trying to do is print out my int x which is declared in my function (bottom part of code). I'm trying to print it out in my main loop. It does not work and clearly I'm not understanding a basic principle of functions. However, I'm sure there is a way to do what I'm asking and it would save me a great deal of coding because I need to reference it quite a few times in a state change system. What is the rright code for what I'm asking?
void setup() {
Serial.begin(9600);
}
void loop() {
int y;
thisFunction(y);
Serial.println (y);
}
void thisFunction(int x){
int reading = analogRead(A0);
int fixReading = (500-reading);
int x = (abs)fixReading
}