How to read four inputs from Serial monitor using Serial.read()?

I can't seem to write an array to read four inputs from Serial monitors. The inputs are sent through phone using HC-05 and arduino. How to read that four inputs? The inputs are originally string but they are to be converted into integer for further use. So should I make that array as String or int? While reading the elements should I use Serial.parseInt() or Serial.read()?

I would suggest to study Serial Input Basics to handle this

dcreates:
I can't seem to write an array to read four inputs from Serial monitors. The inputs are sent through phone using HC-05 and arduino. How to read that four inputs? The inputs are originally string but they are to be converted into integer for further use. So should I make that array as String or int? While reading the elements should I use Serial.parseInt() or Serial.read()?

Four inputs - are they just four ASCII coded charcaters like 1234 or ABCD or 1C3E or the like?

If you have written any codes, please post them.

Sending the data as either space separated or comma separated and terminated by a '\n' (newline) would be my suggestion.
The read the whole line and parse it for the data
See my reading and parsing GPS (CSV data newline termiated) example which also covers converting the text to numbers

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.