Howdy
I have been all over Arduino Language Reference trying to figure out how to receive a command over the USB serial port. Once it’s received I will use the case or ifelse function to decode the command.
I need help in doing this. What I read so far is way over my head an confusing. Can some one help me what seems to be a simple thing. I am newbe to programing , so please excuse my newbe questions. :oops:
Have a great day.
Rocket Nut
That’s a great example darrellg. A big thanks. 
Here is an example of a couple possible command:
File Name >Flight 25
Start Logging > 100
How would I get this string into the sketch? Like you did with the switch is how I would do the decoding of the command. Possible looking like:
// Separate command string from data string
commandstring = ??? // Command extraction code
datastring = ??? // Data string extraction code
// Decode commandstring
switch (commandstring) {
case ‘File Name’:
logfile = SD.open(datastring, FILE_WRITE);
case ‘Start Logger’:
LoggerSampleRate = int(datastring);
LogData(LoggerSampleRate);
default:
Serial.println(“Bad Command”);
}
I just need help in the extraction of the command and data strings. I know I can use an array, its the reading of string is where I am stumped.
Rocket Nut