I'm trying to controll my stepper motor without using a library.
I want to control it via serial. I need three variables - direction (left, right), number of steps and speed.
Here's my problem - I would like to tell all this to arduino via serial. For example write in Serial Monitor: right, 100, 100 and watch my stepper moving.
I have few problems here - how can I read multiple chars from serial? When i noramlly type '100', arduino treats it as 1, 0, 0.
Second thing - even if I sucseed to read the data into an array, I still do not know how to use it later. I have no idea how to convert an array or string to integer, which i need :/.
Right is not a direction a stepper motor could understand. In case you haven't noticed, stepper motors rotate. Clockwise and counterclockwise are the only directions they understand.
Surely that's 'righty tighty'
Yes. It is up to you to store them in an array until the end of packet marker (comma, enter, whatever) arrives, then deal with the string you have stored. If the string represents a single number, atoi() will convert it to an int for you.
Well, now you do.
Do i store them in array by Serial.readBytesUntil()?
Questions on how to handle Serial comms come up on a daily basis,
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16