Go Down

Topic: LiquidCrystal - setCursor() tutorial program correction. (Read 1 time) previous topic - next topic


Tutorial example available at http://arduino.cc/en/Tutorial/LiquidCrystalSetCursor
has a small problem. In loop function variable names are wrong.

1) thisCol Should be thisRow
2) thisRow Should be thisCol

Its working fine since he compared thisRow to numCols and thiscol to numRows but naming is wrong.
It has no impact on working but confuses reader.

 for (int thisLetter = 'a'; thisLetter <= 'z'; thisLetter++) {
   for (int thisCol = 0; thisCol < numRows; thisCol++) {
     for (int thisRow = 0; thisRow < numCols; thisRow++) {

Correct loops are

void loop() {
 // loop from ASCII 'a' to ASCII 'z':
 for (int thisLetter = 'a'; thisLetter <= 'z'; thisLetter++) {
   // loop over the columns:
   for (int thisRow = 0; thisRow < numRows; thisRow++) {
     // loop over the rows:
     for (int thisCol = 2; thisCol < numCols; thisCol++) {
       // set the cursor position:
       // print the letter:

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!

via Egeo 16
Torino, 10131