Wrong line with lcd.setCursor

userHead ElodieCEMOI 2026-06-24 00:16:15 241 Views3 Replies

Hi,

 

I use a DFR0555 with my Arduino Every board, and a text is displayed on the 2nd line whereas I expect it to be displayed on the 1st line.

 

Here is the code:

  strcpy(active_input, "    Input 2"); 
  lcd.clear(); // clear display
  lcd.setCursor(0,0); // Met le cursor en left top line (0 from 0-15, Ligne 1)
  lcd.print(active_input); 

 

and here is the display:

 

Where is the problem ??

 

Thank you very much,

2026-06-25 11:22:31

One possible cause is the LCD library/initialization. In the official DFR0555 Wiki example, the library used is:​
#include "DFRobot_RGBLCD1602.h"​


and the LCD object should be initialized according to the hardware version.​
Please note the RGB address setting in the example:​
• LCD1602 Module V1.0: 0x60​
• LCD1602 Module V1.1: 0x6B​
• LCD1602 RGB Module V1.0: 0x60​


Your module looks like the LCD1602 Module V1.0, so please try:​
DFRobot_RGBLCD1602 lcd(0x60, 16, 2);​


Please test with the official DFR0555 Wiki example first:
https://wiki.dfrobot.com/dfr0555/docs/24390

userHeadPic Yx
2026-06-24 11:37:53

Hi, 

 

lcd.setCursor(0, 0) should normally point to the first line, while lcd.setCursor(0, 1) is the second line.

 

Your cursor setting looks correct, so the issue may be related to the LCD library, initialization, or another part of the program.

 

I’d suggest trying the official example from the DFR0555 Wiki first and checking whether line 1 and line 2 display correctly there. 

 

You can also post the full sketch, especially the #include line, LCD object initialization, and setup() part, so others can help check it.

userHeadPic Yx
ElodieCEMOI wrote:

Here is the include part of the program:

 

// DEBUT DES DECLARATIONS DE LIBRAIRIES POUR ECRAN LCD
#include <Wire.h>  // librairy requise pour l'écran LCD, incluse dans l'IDE Arduino et qui n'apparaitra donc pas 
     // dans le sous-dossier 'Librairies' du répertoire Arduino
#include <DFRobot_LCD.h> // librairy gérant les afficheurs DFRobot 0555 et équivalents
DFRobot_LCD lcd(16,2);  //16 characters and 2 lines of show
// FIN DES DECLARATIONS DES LIBRAIRIES POUR ECRAN ECRAN LCD 

 

and here is the setup() part:

 

void setup()
{
// Serial.begin(9600); // Démarre le transmetteur série pour voir les résultats sur PC
Serial.begin(9600); // Démarre le Moniteur Série pour voir les résultats sur PC
      // on passe la vitesse à 115.200 car ça a été validé avec "Test_HC08_v120.ino"
      // il faut bien sûr passer à 115.200 sur le Moniteur Série du PC dans l'IDE Arduino.
Serial.println("Entree dans void setup");

Wire.begin();
Serial.println("Wire demarre pour I2C"); // pour démarrer Wire, donc I2C

lcd.init(); // initialisation de l'afficheurs
Serial.println("LCD init");
lcd.setCursor(3,0); // colonne 3 et ligne 0
lcd.print("Design by"); 
lcd.setCursor(1,1); // Colonne 0 et Ligne 1
lcd.print("G. CAVALLERIO"); // colonne 0 et ligne 1
delay(6000);
lcd.clear(); // devrait effacer l'écran après 6s
 
// irrecv.enableIRIn(); remplacé par les 2 instructions ci-après selon "NA_ZXL_v422.ino" qui fonctionne avec IRremote 3.3.0

IrReceiver.enableIRIn(); // Starts the IR receiver
IrReceiver.begin(RECV_PIN, ENABLE_LED_FEEDBACK); // c'est l'instruction de remplacement donné par le Wiki Youtube
             // pour la librairy IRremote version 3.3.0
             
lcd.setCursor(5,0);   // Colonne 5 et Ligne 0
lcd.print(active_input); // doit afficher "Ready" sur l'écran LCD juste après l'initialisation de I.R.

// On définit les pins MOTOR de la Nano en Output
pinMode(Motor1Pin1, OUTPUT);
pinMode(Motor1Pin2, OUTPUT);
pinMode(Motor2Pin1, OUTPUT);
pinMode(Motor1Pin2, OUTPUT);

// Et aussi tous les pinmode des RELAIS en Output ici:
pinMode(relais1,OUTPUT);
pinMode(relais2,OUTPUT);
pinMode(relais3,OUTPUT);
pinMode(relais4,OUTPUT);
pinMode(relais5,OUTPUT);
pinMode(relais6,OUTPUT);
pinMode(relais7,OUTPUT);
pinMode(relais8,OUTPUT);
pinMode(relais9,OUTPUT);

 

Do you see any problem with them ???

 

Meantime I am OK to try the “official example from the DFR0555 Wiki first and checking whether line 1 and line 2 display correctly there” : I have tried to find one, but have not found it; do you have a link ?

 

Thank you very much,

2026-06-24 17:41:39
1 Replies