Request User Input

Hey,

For some reason, it seems to be hard to get any information on receiving user input from a computer to send to the Arduino.

What I’m looking for is a function similar to ‘cin >> I’ in C++ or ‘input()’ on Python.

If anybody wants to know what situation I want to use it in, it would be with servos in situation like:

#include <Servo.h>

Servo servo_2;

int angle = 20;

Void setup(); {
servo_2.attach(2);
}

Void loop(); {
‘Request input code and assign the string to a variable/data type’

If (x == ‘A’) {
servo_ 2.write(angle)
}
}

Take a look at Serial input basics - updated for some ideas

Thanks. It probably seems like a ridiculously basic question to ask but I just couldn’t seem to find an answer anywhere.

What user interface do you want to run on the computer?

Can it send the data in the start/end marker format suggested in Robin2's tutorial?

justcunn:
For some reason, it seems to be hard to get any information on receiving user input from a computer to send to the Arduino.

The business of getting user input usually involves two parts {A} prompting the user for input and {B} receiving the data typed by the user.

The examples in Serial Input Basics deal with the second part. If you need some assistance with the first part there is a simple user-input example in Planning and Implementing a Program

...R

"For some reason, it seems to be hard to get any information on receiving user input from a computer to send to the Arduino."

The serial monitor in the IDE has always worked well for me.