I want to get the output of variable 'data' from the serial monitor once, but it comes up twice. What's the problem? (this code is addiction program)
float data;
bool s=0;
void setup()
{ Serial.begin(9600);}
void loop(){
if (Serial.available() > 0 )
{ float temp =(float)Serial.parseFloat();
data += temp;
Serial.println(data);}
}
gcjr
2
what exactly is the input?
what do you expect if the input contains something other than a float?
what is your serial monitor ending is set to? set it to none.
Is it "ending" Tab or "Line ending" Tab?
Is it "none" or "No line ending"?
Where does the word tab come from? Nobody used it till you did.
I don't think anybody cares. If @kis000321 does not understand, he/she can ask.
system
Closed
6
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.