Go Down

Topic: setCursor example in Arduino "learning" (Read 1 time) previous topic - next topic

big trumpet

Hi,

For the learning example in arduino website LiquidCrystal library > setCursor



As I understand the syntax of lcd.setCursor is lcd.setCursor(col, row)

I think the descriptions above the code :

lcd.setCursor(0, 0); // top left
lcd.setCursor(0, 15); // top right
lcd.setCursor(1, 0); // bottom left
lcd.setCursor(0, 15); // top right


should be

lcd.setCursor(0, 0); // top left
lcd.setCursor(15, 0); // top right
lcd.setCursor(0, 1); // bottom left
lcd.setCursor(15, 1); // top right
;) ;)

So the example code works fine( at least on my lcd module), but be aware that in lines 55 to 62 :
variable thisRow is actually referring to the column
variable thisCol is actually referring to the row

I tried this on arduino 0017

Cheers

floresta

big trumpet:

This is not the only place where the rows and columns have been interchanged.  It appears that some of the Playground pages were edited incorrectly several months ago.  A few days ago I sent a private message about this to the person who I believe made those changes but I have not received an answer back.

I started a thread about this last Friday (http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1259290563) but as of today I am 0 for 68 on responses.

I don't have much C programming experience and I am afraid that if I try to fix things myself I might just make them worse.  None the less I plan to start soon if I don't hear back.

Don

big trumpet

Hello Floresta,

I think the guy who's writing the LiquidCrystal library has done a good job, but learning examples just need to catch up a bit. :P :P

I tried the "HelloWorld" again, but it seems working fine. It is set  :
lcd.begin ( 16, 2 )  for a 16 characters x 2 rows / lines display

In the funny world of lcd displays, the (0,0) is top left, which is quite different from conventional x,y co-ordinates in the math books. I think this is confusing sometimes.

Cheers

floresta

big trumpet

Quote
I think the guy who's writing the LiquidCrystal library has done a good job

He's a "she".

The library is fine.  The Playground description is OK but could use some work.  The 'Hello World' example in the Playground is FUBAR.

Don

tytower

Quote

should be

lcd.setCursor(0, 0); // top left
lcd.setCursor(15, 0); // top right
lcd.setCursor(0, 1); // bottom left
lcd.setCursor(15, 1); // top right


dont you mean "lcd.setCursor(15, 1); // bottom right"  ?

CaptainObvious

Really? You make a post just to point out a typo?


......
:-?

Quote
In the funny world of lcd displays, the (0,0) is top left, which is quite different from conventional x,y co-ordinates in the math books. I think this is confusing sometimes.

There are alot of little things like this to get used to with microcontrollers :D  ... such as counting starting at 0, I made many a mistake when first starting out.. always start counting at 1 and mess things up. :P

And I got an LCD that has 131x131 pixels... and it's the same way! Makes for a hassle when you're trying to remember exactly where that pixel would be on the screen. :P

mellis

CaptainObvious: making a post to point out a typo is a good thing!  We want to fix problems like this.  Don't judge the posters here, please.

retrolefty

#7
Dec 23, 2009, 06:18 pm Last Edit: Dec 23, 2009, 06:19 pm by retrolefty Reason: 1
Agree, however typos in code are educational, typos in comments not as much.

Lefty

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy