B4R Question Liquidcrystal_I2C

atiaust

Active Member
Licensed User
Hi Erel,

Is there any plans for a rLiquidcrystal_I2C library.

I have a working Arduino library but don't know how to convert it to B4R.

Any help kindly appreciated.

Thanks
 

Erel

B4X founder
Staff member
Licensed User
Try the attached library. The setting for the Initialize method are not clear.

B4X:
ub Process_Globals
   Public Serial1 As Serial
   Private lcd As LiquidCrystal_I2C
End Sub

Private Sub AppStart
   Serial1.Initialize(115200)
   Log("AppStart")
   lcd.Initialize(0x27, 20, 4) 'based on the example from the project.
   lcd.Write("test")   
End Sub
 

Attachments

  • rLiquidCrystal_I2C.zip
    5.9 KB · Views: 235
Upvote 0

atiaust

Active Member
Licensed User
Try the attached library. The setting for the Initialize method are not clear.

B4X:
ub Process_Globals
   Public Serial1 As Serial
   Private lcd As LiquidCrystal_I2C
End Sub

Private Sub AppStart
   Serial1.Initialize(115200)
   Log("AppStart")
   lcd.Initialize(0x27, 20, 4) 'based on the example from the project.
   lcd.Write("test")  
End Sub
Thanks Erel,

The basic functions of the library work. The "test" appears on the LCD (bit hard to read without the backlight)
To Initialize the LCD that I have it is (0x3F, 16, 2)
0x3F for the address, 16 for the number of characters and 2 for the number of lines.

I will try to add to the library.

Thanks again.
 
Upvote 0

thedeadhand

Member
Licensed User
i noticed that the back light wasn't turned on so here's a working code.
B4X:
#Region Project Attributes
    #AutoFlushLogs: True
    #CheckArrayBounds: True
    #StackBufferSize: 300
#End Region

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
End Sub

Private Sub AppStart
       Serial1.Initialize(115200)
   Log("AppStart")
   lcd.Initialize(0x3F, 16, 2) 'based on the example from the project.
   lcd.Backlight = True
   lcd.Write("test") 
End Sub
 
Upvote 0
Top