44Views0Replies

Author Options:

When I send multiple values (Y,Z) through serial monitoring, then the data will automatically becomes (0,0). Answered

Hello everyone. I was using this code before with no trouble. But recently when I use the code, then it will set the data (0,0). I really can't understand why? I attached the photo of what I received in the serial monitor. you can see in the photo. for exampe when I give the value of (5,5), then automatically gives (0,0) again. it happens for other values as well. please help. I got headache.

long Y,Z;
void setup() {

Serial.begin(9600); }

void loop() {

while (Serial.available()> 0) {

Y = Serial.parseInt();

Z = Serial.parseInt();

Serial.print ("(");

Serial.print ("Y");

Serial.print (",");

Serial.print ("Z");

Serial.print (")");

Serial.print ("=");

Serial.print ("(");

Serial.print (Y);

Serial.print (",");

Serial.print (Z);

Serial.println (")");

}

}

Comments

The forums are retiring in 2021 and are now closed for new topics and comments.