Pages: [1]   Go Down
Author Topic: setCursor example in Arduino "learning"  (Read 1133 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 50
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
 smiley-wink smiley-wink

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
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 39
Posts: 4389
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 50
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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. smiley-razz smiley-razz

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
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 39
Posts: 4389
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

tytower
Guest
 Bigger Bigger  Smaller Smaller  Reset Reset

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"  ?
Logged

Spokane, Washington
Offline Offline
God Member
*****
Karma: 1
Posts: 686
My name is Bob, and I'm an addict.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley-grin  ... such as counting starting at 0, I made many a mistake when first starting out.. always start counting at 1 and mess things up. smiley-razz

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. smiley-razz
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 12
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Agree, however typos in code are educational, typos in comments not as much.

Lefty
« Last Edit: December 23, 2009, 12:19:01 pm by retrolefty » Logged

Pages: [1]   Go Up
Jump to: