B4R Library rAdafruitSH1106 - SH1106 lcd

This library is based on: https://github.com/wonho-maker/Adafruit_SH1106

It is very similar to rAdafruitSSD1306 library: https://www.b4x.com/android/forum/threads/radafruitssd1306-oled-displays.68906/ (without the scrolling methods).

It depends on rAdafruitGFX library: https://www.b4x.com/android/forum/threads/68904/#content

Example:
B4X:
Sub Process_Globals
   Public Serial1 As Serial
   Private ssd As AdafruitSH1106
   Private vx = 3, vy = 3 As Int
   Private px, py As Int
   Private radius As Int = 3
   Private tmr As Timer
End Sub


Private Sub AppStart
   Serial1.Initialize(115200)
   Log("AppStart")
   ssd.InitializeI2C(4, 0x3c)
   ssd.ClearDisplay
   tmr.Initialize("tmr_Tick", 10)
   tmr.Enabled = True
End Sub

Private Sub tmr_Tick
   ssd.GFX.DrawCircle(px, py, radius, ssd.BLACK, True)
   px = px + vx
   py = py + vy
   If px - radius <= 0 Then vx = Abs(vx)
   If px + radius >= ssd.GFX.Width Then vx = -Abs(vx)
   If py - radius <= 0 Then vy = Abs(vy)
   If py + radius >= ssd.GFX.Height Then vy = -Abs(vy)
   ssd.GFX.DrawCircle(px, py, radius, ssd.WHITE, True)
   ssd.Display 'apply the drawings
End Sub
 

Attachments

  • rAdafruitSH1106.zip
    33.4 KB · Views: 529

Peter Simpson

Expert
Licensed User
Longtime User
Hello @Erel,
Hmm I cant' really try this library at the moment as I'm away on holiday in the west indies. I'll be back next week for a couple of weeks, so I'll try the library before to go to Spain for a weeks holiday.

But first I have to try and find my 1106 display ;)
 
Top