How to get an array from serial read

what i am doing in a python script is taking input from my game controller and rearranging it to 0 being neutral and 1 being full left or right as a rounded float to 4 decimal places.

on arduino i want to take that data and move stepper motors with the accelstepper library.

i have tried sending an f string however i get an error substring not defined and am unable to get string.h or wstring.h library to work in any way whatsoever for using substrings to get my data that way.

then i tried to pack a list in python and send it over i have no idea where to start there on arduino i cant find any documentation or sources that actually work.

ps i dont just want an answer i want to understand why this is so hard for me to grasp. there is one single forum post i found on arrays form serial read but it does not work for me at all. i am not good at arduino so please be generous.

python list method

m = pack('ff',m1,m2)
serial.write(m)

and python string method

newline = '\n'
fstring = (f'{m1},{m2} {newline}')
fstring = bytes(fstring, 'utf-8')
serial.write(fstring)

my arduino code is here. im not even going to show you what i did based on other few posts to try to communicate on arduino i know it has to be so wrong. setspeed value will replace 100000 with value from python im sending


#include <AccelStepper.h>
#include <MultiStepper.h>

#define ENABLE1 9
#define ENABLE2 12
#define MODE0 8
#define MODE1 7
#define MODE2 6
#define RESET 5
#define SLEEP 4
AccelStepper motor1(1, 3, 2);
AccelStepper motor2(1, 11, 10);

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  pinMode(ENABLE1, OUTPUT);
  pinMode(ENABLE2, OUTPUT);
  pinMode(MODE0, OUTPUT);
  pinMode(MODE1, OUTPUT);
  pinMode(MODE2, OUTPUT);
  pinMode(RESET, OUTPUT);
  pinMode(SLEEP, OUTPUT);
 
  digitalWrite(ENABLE1, LOW);
  digitalWrite(ENABLE2, LOW);
  digitalWrite(RESET, HIGH);
  digitalWrite(SLEEP, HIGH);
  digitalWrite(MODE0, HIGH);
  digitalWrite(MODE1, HIGH);
  digitalWrite(MODE2, LOW);
  motor1.setMaxSpeed(100000);
  motor2.setMaxSpeed(100000);
}

void loop() {
  motor1.setSpeed(100000);
  motor2.setSpeed(100000);
  motor1.runSpeed();
  motor2.runSpeed(); 
}

here is how i want to run the script

  if (myArray[0] > 1.01){
    motor1.setSpeed((myArray[0] -1) * 103500);
  }
  else if (myArray[0] < 0.99){
    motor1.setSpeed((((myArray[0] / 1) * (-1)) + 1) * 103500);
  }
  if (myArray[1] > 1.01){
    motor2.setSpeed((myArray[1] -1) * 103500);
  }
  else if (myArray[1] < 0.99){
    motor2.setSpeed((((myArray[1] / 1) * (-1)) + 1) * 103500);
  }
    motor1.runSpeed();
    motor2.runSpeed();

Take a look at Serial input basics - updated

forgot, i made python send +1 vs range of -1 to 0 to 1. instead it sends 0 to 1 to 2 as float so that it doesnt send any negative numbers

i was able to get the string fine but processing it after i received it is another problem

i have tried strtok that also provided an error as string library wont work

Please post an example of the serial data received by the Arduino, and how you want to "process" that information.

i actually have already. please see python code pieces. how i want to process it is hidden in the text i took my own time to write for you to not read

Please un-hide it then.

i didnt know it was hidden how do i fix it?

Really? You said it is hidden. I quoted you.

hidden meaning its right there just doesnt want to use reading skills that was sarcasm

Do you want help here?

yes but im not going to answer someones question like that when all they gotta do is read

i felt offended, sorry

newline = '\n'
fstring = (f'{m1},{m2} {newline}')
fstring = bytes(fstring, 'utf-8')
serial.write(fstring)

For those of us not as familiar with Python as you are, the actual received message is more important than the sent one.
For example is the received message on Arduino

m1,m2\n or are the curly braces present.

Is it being received as a String object or c-string?

m1 and m2 are both floats between 0 and 2. it should read something like 1.005,1.005

You are attempting to sidestep the important, time proven necessity of posting your sketch so people can properly evaluate it. That won't fly.

there isnt any more code for me to post the rest is garbage

Then you have some work to do.

why do you think im here......