Hi everyone,
I'm having some troubles with the "String" function in my Arduino program.
The purpose of the program is to process an information sent by the computer (a number between 0 and 255) to control a transistor with "PWM". The problem is : if I use the fonction "char variable = Serial.Read();" The Arduino send the numbers separatly. For example, if I send "255" in the Serial terminal, the Arduino return "2" then "5" then "5" instead of "255". The solution was to use the "String" function, however this function need 1 second to process the information. The computer is sending an information every 200 milliseconds so the Arduino is not as quick as the information is received.
The program :
void setup() { Serial.begin(9600); }
void loop() {
if (Serial.available() > 0) {
String test = Serial.readString();
Serial.println(test); }
}
For your information, I'm using an Arduino Uno
Thanks for your help,
Yoann56