Pages: [1]   Go Down
Author Topic: Output question (loop/erase)  (Read 233 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi guys,
I don't know how to put my question into one sentence, so I am just going to describe it. It may sound dumb, but here:
I have ten outputs per second, e.g.
6
77
4
5
2
but once I start to get two digits:
12
72
52
42
the 12 goes back to 7, then to 5, then 4. The 2 stays there and does not go away until another two digit number comes.

How do I loop/erase the second digit for every output?
Might be a very simple answer but I don't know how to do it.

Thanks!
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 291
Posts: 25874
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Print a space if the value you're about to print is less than 10.
Or always print a trailing space.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48556
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I have ten outputs per second
Outputs to what?

Quote
How do I loop/erase the second digit for every output?
Erase it from what?

Sure be nice to know what you are talking about. Though I agree with AWOL as to the solution.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry, it was in the middle of the night when I wrote this.
It outputs ten numbers per second to the LCD.
I want the program to erase every output from the LCD.
AWOL gave me a good solution,
I had something like
lcd.print(sum + "  ");
but it does not work correctly and gives me letters/strings.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 291
Posts: 25874
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I certainly did not give you that solution.
Code:
if (x < 10) {
  Serial.print (" ");
}
Serial.print (x);
is pretty much what I wrote.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Pages: [1]   Go Up
Jump to: