Not sure if I need to use pointers or if there is another method but here is the code I am needing help with:
int processSteer (const unsigned int value)
{
int steeringInput = constrain(value, 490, 970);
return steeringInput;
}
int handle()
{
//inside a switch statement, reason for break
//currentValue is a value being read in
static int target = 0;
target = processSteer(currentValue);
break;
}
} // end of switch
void processX(const byte c)
{
......
handle();
}
void loop()
{
if(Serial.available())
{
processX(Serial.read());
}
else{
if (x==target)
........
}
}
My main question is, being able to use the static int target in the loop function. Is there a way to call this to be able to use since I did not initialize it inside the void loop?