Pages: [1]   Go Down
Author Topic: LCD: erasing printed data? clearing specific fields?  (Read 1081 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 153
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

howdy. thank you in advance for reading.

i have a 16x2 LCD screen that i have configured to print values being read from a pixart infrared sensor.
the code prints the x and y values as read by the sensor. the resolution of this sensor is 1024 by 780.

let's say i do the following:
read/print X values from the sensor starting at 0, then moving up to 10, then 100, and finally 1000.
now, i move in reverse - back down to 0.
problem: the numbers printed from the upper ranges (1000, etc) are not cleared when printing lower values.

i am unfamiliar with how to handle this, as this is my first experiment with an LCD screen. i don't want to clear the whole screen, i just want to print ONLY the digits being read from the sensor.

i hope this is clear. thank you for your time.
nym
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 153
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

here is an example of what i am doing, with a commented out portion where i was trying to print blanks where otherwise there would be leftover numbers.

Quote
Code:
  int calibration[4];
  int X1 = ircam.Blob1.X;
  int Y1 = ircam.Blob1.Y;
  if (result & BLOB1)
  {
    lcd.setCursor(9,0);   
    lcd.print("X: ");       
    lcd.setCursor(0,1);         
    lcd.print("Left: ");   
    lcd.setCursor(9,1);   
    lcd.print("Y: ");     
    lcd.setCursor(11,0);
//    lcd.rightToLeft();
//    if(X1 < 1000){lcd.print(" ");}
//    if(X1 <  100){lcd.print("  ");}
//    if(X1 <   10){lcd.print("   ");}
    lcd.print(X1);   
//    lcd.leftToRight();
    lcd.setCursor(11,1);
    lcd.print(Y1);   
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 153
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

started figuring it out, but it seems like overkill to have to do if lesser thans for every degree.

Code:
 if (result & BLOB1)
  {
    lcd.setCursor(9,0);  
    lcd.print("X: ");      
    lcd.setCursor(9,1);  
    lcd.print("Y: ");    
    if(X1 < 1000){
      lcd.setCursor(13,0);
      lcd.print(" ");
    }
    else{
      lcd.setCursor(12,0);
    }
    lcd.print(X1);  
    lcd.setCursor(13,1);
    lcd.print(Y1);    
    lcd.leftToRight();
« Last Edit: May 10, 2012, 04:15:59 pm by nym » Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7197
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

http://arduino.cc/forum/index.php/topic,105187.msg789058.html
Logged


0
Offline Offline
Full Member
***
Karma: 0
Posts: 153
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks! i had searched, but didn't know how to phrase what i was looking for. apparently neither did the other guy.
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7197
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If the search worked so well we would have had a lot less repeat questions. Simply asking a question is a learning process itself so you're welcome.
Logged


Pages: [1]   Go Up
Jump to: