B4R Library rGlyphduino - draw custom characters to LCD display (LCD1602)

This is a wrap for this Arduino library.

Attached:
B4R sample project (you also need to enable the rLiquidCrystal library in the libs tab of the IDE)
rGlyphduino.zip - extract and copy the folder with .cpp and .h files to your B4A additional libs folder and the xml to the root of your B4R additional libs folder.

There are 33 glyphs included in the library. Edit the library code to add more/other glyphs (custom characters)

20190608_102346.jpg


Sample code:
B4X:
#Region Project Attributes
    #AutoFlushLogs: True
    #CheckArrayBounds: True
    #StackBufferSize: 300
#End Region


Sub Process_Globals
    Public Serial1 As Serial
    Private lcd As LiquidCrystal
    Private gd As Glyphduino
   
End Sub

Private Sub AppStart
    Serial1.Initialize(115200)
   
    ' Init the LCD: RS,RW,EN,Data(4)
    lcd.Initialize(8,255,9, Array As Byte(4,5,6,7))
    lcd.Begin(16,2)
    lcd.DisplayOn = True
    ' Init the bignum with lcd display
    lcd.Clear
    gd.Initialize(lcd)
   
    'register the first 4 glyphs
    gd.registerGlyph(0, gd.GLYPHDUINO_ARROW_NE)
    gd.registerGlyph(1, gd.GLYPHDUINO_ARROW_SW)
    gd.registerGlyph(2, gd.GLYPHDUINO_SPEAKER)
    gd.registerGlyph(3, gd.GLYPHDUINO_HEART)
   
    'set cusrsor position to 0,0. Glyphs will be written to current position of the cursor
    lcd.SetCursor(0,0)
    gd.printGlyphAtCursorPosition(gd.GLYPHDUINO_ARROW_NE)
    gd.printGlyphAtCursorPosition(gd.GLYPHDUINO_ARROW_SW)
    gd.printGlyphAtCursorPosition(gd.GLYPHDUINO_SPEAKER)
    gd.printGlyphAtCursorPosition(gd.GLYPHDUINO_HEART)
   
    'register last 4 glyphs
    gd.registerGlyph(4, gd.GLYPHDUINO_PI)
    gd.registerGlyph(5, gd.GLYPHDUINO_BELL)
    gd.registerGlyph(6, gd.GLYPHDUINO_BATTERY_4_BAR)
    gd.registerGlyph(7, gd.GLYPHDUINO_LOCK)
   
    'print specified glyph to specified column and row
    gd.printGlyphAtSpecifiedPosition(gd.GLYPHDUINO_PI, 1, 2)
    gd.printGlyphAtSpecifiedPosition(gd.GLYPHDUINO_BELL, 15, 0)
    gd.printGlyphAtSpecifiedPosition(gd.GLYPHDUINO_BATTERY_4_BAR, 8, 1)
    gd.printGlyphAtSpecifiedPosition(gd.GLYPHDUINO_LOCK, 10, 0)
   

End Sub
 

Attachments

  • rGlyphduino.zip
    5 KB · Views: 406
  • b4rGlyphduino.zip
    1.1 KB · Views: 396
Last edited:
Top