I want to set a string variable that can be changed depending on which function is running it. The problem is that I can set the value initially, but my function doesn't seem to pickup the value change. For example in the beginning of my script, I set it like below. Any ideas?
Then later on in a function, I want to change it in this function:char motorDirection[] = "Not set";
Then later, I want to print it out.void raiseAngle()
{
int sensorValue = analogRead(sensorPin); // read the input pin
mappedValue = map(sensorValue, 5, 804, 0, 92);
motorLinSpeed--;
char motorDirection[] = "Raise";
motorEcho();
if (motorLinSpeed <= -200) {
motorLinSpeed = -200;
}
md.setM1Speed(motorLinSpeed);
}
void motorEcho()
{
if (DEBUGPrint == true) {
Serial.print("Motor:");
Serial.println(motorDirection);
}
}