mLink 20x4 LCD display with Raspberry Pi - Cursor position not working

Forum for posting topics and questions about anything.
Post Reply
edsyoung
Posts: 2
Joined: Wed Jun 04, 2025 11:11 am

mLink 20x4 LCD display with Raspberry Pi - Cursor position not working

Post by edsyoung » Wed Jun 04, 2025 12:29 pm

Hi, I'm using the python mLink library with my Pi 4 model B to control the mlink 20x4 LCD display (bought from HC!)

I've slowed the I2C bus as recommended.

Printing text is working fine but the cursor position command has no effect (no error; no change of cursor position). I tried a delay afterwards, but no change.

Any ideas what is wrong?

Sample code here:

import time
from mLink import mLink

ml = mLink.mLink(1)

ml.cLCD_dispType(0x56, 1)
ml.cLCD_Clear(0x56)

ml.cLCD_Print(0x56, "Hello World xx")

ml.cLCD_Cursor = (0x56, 3, 3)
time.sleep(1)

current_time = time.strftime('%H:%M:%S')
ml.cLCD_Print(0x56, f'Time: {current_time}')

andrew
Site Admin
Posts: 1481
Joined: Sun Aug 05, 2012 4:15 pm

Re: mLink 20x4 LCD display with Raspberry Pi - Cursor position not working

Post by andrew » Wed Jun 04, 2025 2:14 pm

Any ideas what is wrong?

Yes, the issue is caused by the equals sign (=) in your code. You should change this line:

  1.  ml.cLCD_Cursor = (0x56, 3, 3)
...to:
  1.  ml.cLCD_Cursor(0x56, 3, 3)
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

edsyoung
Posts: 2
Joined: Wed Jun 04, 2025 11:11 am

Re: mLink 20x4 LCD display with Raspberry Pi - Cursor position not working

Post by edsyoung » Wed Jun 04, 2025 2:55 pm

Thank you!

Corrected and working - I'm feeling very stupid right now...

Ed

andrew
Site Admin
Posts: 1481
Joined: Sun Aug 05, 2012 4:15 pm

Re: mLink 20x4 LCD display with Raspberry Pi - Cursor position not working

Post by andrew » Wed Jun 04, 2025 3:48 pm

It's ok, I didn't spot it straight away. TBH, I'm surprised it didn't throw a syntax error.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Post Reply

Return to “General Discussion”