B4R Library rAdafruitSH1106 - SH1106 lcd

Discussion in 'B4R Libraries' started by Erel, Apr 22, 2018.

  1. Erel

    Erel Administrator Staff Member Licensed User

    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

    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
       tmr.Enabled = 
    End Sub

    Private Sub tmr_Tick
       ssd.GFX.DrawCircle(px, py, radius, ssd.BLACK, 
       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, 
    'apply the drawings
    End Sub

    Attached Files:

    Hypnos, Mostez, inakigarm and 2 others like this.
  2. Cableguy

    Cableguy Expert Licensed User

    Thanks Erel, will try it today
  3. Cableguy

    Cableguy Expert Licensed User

    It works like a charm!
    Johan Hormaza and Erel like this.
  4. Peter Simpson

    Peter Simpson Expert Licensed 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 ;)
    Erel likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice