Display Python variables 16x2 I2C screen

Hello to everyone

I'm new on this forum and I'm a beginner with arduino and I'm a bit lost
I have a Python script that fetches information from an API and correctly retrieves only the information I am interested in. My problem is that I want these 2 variables to be displayed on a 16x2 LCD screen, connected by I2C on port 0x3f of my arduino UNO
I managed to make the LED of my arduino blink thanks to a Python program, but it was impossible to display anything on the screen connected to my Arduino
Here are the connections made:

I use a Mac Mini M1, but I can use a PC under windows if necessary
Thank you very much !

How do you send the data from Python to the Arduino? (the Mac Mini M1 will be totally fine, it's just Serial communication likely)

➜ you'll need to build a protocol, for example sending "<Val1, Val2>" (ie "<12,22>" for sending 12 and 22) over the serial line. On the arduino side you need to await for a complete message, decode it and display the data

I would suggest to study Serial Input Basics to handle this

regarding the screen, get a library (for example that one is simple) and try an example. If nothing shows on the screen, turn the pot to adjust contrast. sometimes it's just set too low.

The best library around those day is likely the HD44780 library you can install via the Library Manager

1 Like

+1 for the hd44780 library and serial input basics.

To install the hd44780 library. The hd44780 library is the best available for I2C LCDs. The library is available in the Library Manager. Go to Library Manager (in the IDE menus, Sketch, Include Libraries, Manage Libraries) and in the Topics dropdown choose Display and in the Filter your search box enter hd44780. Select and install the hd44780 library by Bill Perry.

The class that you want to use is the hd44780_I2Cexp class. There are examples to show how to use the library. The nice thing about the hd44780 library is that it will autodetect the I2C address and the I2C backpack to LCD pin mapping.

In the examples, there is a diagnostic sketch that will help us to help you if you still have trouble with the display. Run the diagnostic sketch and post the results.

1 Like

So you need to show us - or describe really accurately - what does show on the 1602 display when you try it out with a simple display test example from the HD44780 library.

This includes showing us - according to the instructions - what code you are using.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.