I want to send this text "A=100, B=500, C=300" from the serial monitor to the Arduino

How can I Extract the Value of the Variable "A" which is 100 from the serial monitor and Assign it to the "A" Variable in the Arduino ? Same with the B and C ?


  • You could ignore all the formatting and only detect 'A', 'B', or 'C', then check if there is a '=' and then do atoi. For which arduino board is it? If the text has a specific format, then sscanf could be used. What if your receive "ABC=10" or with spaces "A = 100" or negative numbers "B=-10" or "A=001"? – Jot Jun 1 '19 at 20:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.