Converting string from sd card reader

Let's say you have a line like "G90G01X4.532Y2.750F15"

Coming from sd card how do you break it down to characters integers and floats

The incoming lines are always different

I need to get the different values and do something with them I don't need to print either

Thanks for any help.

Can you give an example of how you would want that line decoded (i.e. as you tear it apart, what should be done with the pieces)? Are there any discernible patterns you always expect to get from the input (e.g. can you say the input will always be organized as a string of pairs consisting of a character(s) followed by a number)?

If G90 then do this
If G01 do this
If X1.532 do this

I'm very new to programming .

The line will always have character then number or two after the x y and z will always have a float after

I'd like to use grbl and have it read from sd card and a touch screen

Is it possible ?

I have something that I made to get the values for a RGB led. It doesn’t work with floats though. I can probably make it handle floats but i’m really tired right now. Perhaps tomorrow when I get a chance.

Give me a second to find the code.

Serial RGB Control

#define IsWithin(x,a,b) ((x >= a) && (x <= b))

#define R_pin 2
#define G_pin 3
#define B_pin 4

typedef struct myColors
{
  byte R;
  byte G;
  byte B;
};

void setup()
{
  // put your setup code here, to run once:
  Serial.begin(115200);
  pinMode(R_pin, OUTPUT);
  pinMode(G_pin, OUTPUT);
  pinMode(B_pin, OUTPUT);
}

void loop()
{
  // put your main code here, to run repeatedly:
  if (Serial.available() > 0)
  {
    myColors ReturnedColors = GetColors(Serial.read());
    analogWrite(R_pin, ReturnedColors.R);
    analogWrite(G_pin, ReturnedColors.G);
    analogWrite(B_pin, ReturnedColors.B);
  }
}

struct myColors GetColors(char tmp)
{
  static myColors C;
  static int Value = 0;
  static char Color = 'R';

  if (IsWithin(tmp, '0', '9'))
    Value = (Value * 10) + tmp - '0';
  else if (IsWithin(tmp, 'a', 'z') || IsWithin(tmp, 'A', 'Z'))
  {
    Color = tmp;
    Value = 0;
  }

  switch (Color)
  {
    case 'R':
    case 'r':
      C.R = Value;
      break;

    case 'G':
    case 'g':
      C.G = Value;
      break;

    case 'B':
    case 'b':
      C.B = Value;
      break;
  }
  return C;
}