I am experimenting with some code from a parsed serial example.
The example parses a serial string of <text, integer, floating point variable>
I want to be able to substitute the text part of the string into the command
messageFromPC.write(integerFromPC)
in order to select a particular servo, by having the text be the servo's name. The substitution of the integer worked fine.
But I get an error message of :
Arduino: 1.8.5 (Windows Store 1.8.10.0) (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
C:\Users\xxxxxxxxxxxx\Documents\Arduino\parsedservoserial\parsedservoserial.ino: In function 'void servoWrite()':
parsedservoserial:119: error: request for member 'write' in 'messageFromPC', which is of non-class type 'char [32]'
messageFromPC.write(integerFromPC); // tell servo to go to position in variable 'pos'
^
exit status 1
request for member 'write' in 'messageFromPC', which is of non-class type 'char [32]'
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
after editing in the text variable "messageFromPC" into the write command.
Is there a way to convert the variable char messageFromPC
into the correct type of variable that I can use to substitute for the servo name, in the command
messageFromPC.write(integer)