Splitting up a string into three

Hello,
I am building a project with a remote robot controlled over Lora. The commands will be sent as strings. Now, I thought that it would be more efficient if I were to send a single string consisting of three words per command, for example "Turn 180 12:00". The first word in the string is the command, the second one additional data to the command and the third the time when the robot will start executing that command.

Is there a way for the Arduino to split up a string in three different strings, so that each part of the command can be analyzed separately?

Thank you in advance!

Take a look at the strtok() function. It will do what you want

Why send ASCII which you then have to parse and interpret on the RX side? Instead, define a 'struct' that will contain a command number and any extra data required. Send it as a whole, numerically. Don't convert to ASCII.

@gfvalvo I simply did not know about structs, maybe because I am not yet the best in C++. But thank you! Would it be possible to send an entire struct over I2C using the Wire.h library, or would I have to send the variables in it separately?

@UKHeliBob Thank you, that is exactly what I needed!

projectcolumbus:
Would it be possible to send an entire struct over I2C using the Wire.h library

Yes. Have a look at this Arduino to Arduino I2C Tutorial

...R

projectcolumbus:
Would it be possible to send an entire struct over I2C using the Wire.h library

Yes, but you may have problems if the architecture of the sender and receiver are not the same.

Also, consider that if you stick with your original plan, you can do manual testing on the receiver using the serial monitor, which may be an advantage.

projectcolumbus:
Would it be possible to send an entire struct over I2C using the Wire.h library, or would I have to send the variables in it separately?

Thought you were using LoRa?

@Robin2 Thank you, your tutorials/explanations are great!

@gfvalvo Yes, I am using Lora to transmit commands, I guess I simply mixed up the wire library with a Lora one. My bad!