This is a wrapper for this open source project: https://github.com/marcoschwartz/LiquidCrystal_I2C
It supports DFRobot I2C LCD displays.
It supports DFRobot I2C LCD displays.
Dim CharMap() As Byte = Array As Byte (0x00,0x1B,0x1B,0x00,0x11,0x1F,0x0E,0x00)
lcd.CreateChar (0, CharMap)
'To display the custom character, use this:
lcd.Write (Array As Byte(0))
It doesn't work for me !For anyone interested, I modified this library to support creating custom characters without the need for using inline C. I gave it a new name (rLiquidCrystal_I2C_Cust) but if Erel chooses, he can just merge the changes into an updated version of his library.
The original C library supports up to 8 custom characters, numbered 0-7.
I use this webpage to generate the characters. It has an option to output hex which seems to work best for me for creating the byte array in B4R. You can copy & paste the hex results, but you'll just need to remove the carriage returns after pasting into the IDE.
Code:
B4X:Dim CharMap() As Byte = Array As Byte (0x00,0x1B,0x1B,0x00,0x11,0x1F,0x0E,0x00) lcd.CreateChar (0, CharMap) 'To display the custom character, use this: lcd.Write (Array As Byte(0))
It doesn't work for me !
Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public Serial1 As Serial
Private lcd As LiquidCrystal_I2C
Dim CharMap() As Byte = Array As Byte (0x00,0x1B,0x1B,0x00,0x11,0x1F,0x0E,0x00)
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
lcd.Initialize(0x3F, 16, 2) 'based on the example from the project.
' lcd.Initialize(0x27, 20, 4) ' for 20X4 lcd
lcd.Backlight = True
lcd.SetCursor(0,0)
lcd.CreateChar (0, CharMap)
lcd.Write (Array As Byte(0))
lcd.SetCursor(0,1)
lcd.Write("99999999") ' this shows
End Sub
Good idea but I know that of course.I2C screens have addresses, so you should start by that, check if your screen address is the one used in the code and if not change in the code to match your screen!
Did all that - still nothing.The only thing I can think of to try would be to uncheck the rLiquidCrystal_I2C_Cust library in the IDE, then right-click and choose Refresh, then re-check the rLiquidCrystal_I2C_Cust library to add it back in. Also, of course, be sure that you have already UN-checked the original rLiquidCrystal_I2C library.
Failing that, perhaps try cleaning the project.
I don't understand. I use pins A4 and A5 as sda and scl pins.While working on this change to the library, I recall reading that some people had issues using slot 0 with the original C library, so perhaps you can try changing it to use Slot 1 instead.
Did all that - still nothing.
I don't understand. I use pins A4 and A5 as sda and scl pins.
Dim CharMap() As Byte = Array As Byte (0x00,0x1B,0x1B,0x00,0x11,0x1F,0x0E,0x00)
lcd.CreateChar (0, CharMap)
'To display the custom character, use this:
lcd.Write (Array As Byte(0))
The LCD works but it does not show the custom char. Using Arduino UNO.
B4X:Sub Process_Globals 'These global variables will be declared once when the application starts. 'Public variables can be accessed from all modules. Public Serial1 As Serial Private lcd As LiquidCrystal_I2C Dim CharMap() As Byte = Array As Byte (0x00,0x1B,0x1B,0x00,0x11,0x1F,0x0E,0x00) End Sub Private Sub AppStart Serial1.Initialize(115200) Log("AppStart") lcd.Initialize(0x3F, 16, 2) 'based on the example from the project. ' lcd.Initialize(0x27, 20, 4) ' for 20X4 lcd lcd.Backlight = True lcd.SetCursor(0,0) lcd.CreateChar (0, CharMap) lcd.Write (Array As Byte(0)) lcd.SetCursor(0,1) lcd.Write("99999999") ' this shows End Sub
lcd.CreateChar(0, CharMap)
lcd.SetCursor(0,0)
lcd.Write(Array As Byte(0))
That did it !Hello, set lcd.SetCursor(0,0) after lcd.CreateChar
B4X:lcd.CreateChar(0, CharMap) lcd.SetCursor(0,0) lcd.Write(Array As Byte(0))
Good catch! I was pretty baffled as to why it wasn't working for him.Hello, set lcd.SetCursor(0,0) after lcd.CreateChar
B4X:lcd.CreateChar(0, CharMap) lcd.SetCursor(0,0) lcd.Write(Array As Byte(0))
Sub write_sunday
lcd.CreateChar (0, resh)
lcd.CreateChar (1, aleph)
lcd.CreateChar (2, shin)
lcd.CreateChar (3, vav)
lcd.CreateChar (4, nuns)
lcd.SetCursor(11,0)
lcd.Write (Array As Byte(4,3,2,1,0))
End Sub
There can be only 8 different custom chars on the screen at a time, for most of the words it enough but not for full screen text.
The limit of 8 chars exists both in the original library and in Kevin's additions to it.Isn't this an available memory issue?
I mean, with a wemos (4mB) you should be able to declare/store more custom characters, right?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?