Yes.
Get rid of this,
And put
int potVal = map(command.toInt(), 0, 1023, 0, 180);
myServo.write(potVal);
Inside of the parseCommand function, replacing whatever was inside.
@nrobinson2000
Like this?
if (readString.length() > 0) // If a string has been read...
{
Serial.println("Received: " + readString); // Send the parsed string to Serial for debugging
parseCommand(readString); // Do something with the string...
readString = ""; // Clear the string
int potVal = map(command.toInt(), 0, 1023, 0, 180);
> myServo.write(potVal);
}
I get an error that says 'command' was not declared in this scope
This is also not necessary.
No, there is a void parseCommand(String command)
before setup()
. Put it in there, getting rid of the if (command == "foo")
stuff.
It works!!!
Thanks so much!!! I never wouldâve been able to figure that out!!!
Youâre welcome.