B4R Question Help to write a simple hello world on that board

Bokka

Member
Hello everyone!

I just bought this Arduino board to do some tests:



But I ask you for help to get started.

I have already configured the arduino IDE to download the software to the board and I have already tried a small application (that works).

Could someone please post a very simple program that makes "Hello world" appear on the display?

Do you need any particular library or is it already included in B4R by default?

Thanks so much!
 

Bokka

Member
With that example code taken from the forum, the display remains black

B4X:
Sub Process_Globals
     Public Serial1 As Serial
     Private ssd As AdafruitSSD1306
     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(23, 21)
    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

I'm using the "rAdafruitGFX" and the "rAdafruitSSD1306" libraries.

Also, looking at the schematic of the card, I tried to change the row

"ssd.InitializeI2C (23, 21)"

with

"ssd.InitializeHSPI (16,23,5)"

But without success
 
Last edited:
Upvote 0

derez

Expert
Licensed User
Longtime User
the board is esp32 , not arduino. See this:
 
Upvote 0

janderkan

Well-Known Member
Licensed User
Longtime User
Your board have, as you can see on your picture, a display based on the ST7789V chip and you use a software library for a display based on the SSD1306 driver.
I dont know the difference, but maybee that is your problem.
 
Upvote 0

Bokka

Member
So currently it is not possible to use B4R to program this board (at least the part of the OLED display) ....😢

In all cases thank you very much for the answers 👍
 
  • Like
Reactions: DMW
Upvote 0

thetahsk

Active Member
Licensed User
Longtime User
So currently it is not possible to use B4R to program this board (at least the part of the OLED display) ....😢

In all cases thank you very much for the answers 👍

Check this example and port it to B4R.
 
Upvote 0

Bokka

Member
Check this example and port it to B4R.

That example works perfect, but the library for ST7735r seems not compatible with ST7789V
 
Last edited:
Upvote 0

Bokka

Member
if there is a working Arduino lib...
--check if you can use inline C

Ok, I can take the library used by the snake example (ESP32_eSPI_snake) and that library works fine. But I absolutely don't know how to use it on B4R.

The best is to have a B4R api from that library.

Btw thanks again for the help and the replies!
 
Upvote 0

Bokka

Member
It is too difficult for me to implement C code inside a B4X project. I understand that there are guides that explain well how to do it, but unfortunately I don't have so much time to devote to learning this thing, I hoped that there was a faster way with a library ready to focus more on my goal. I also probably made a mistake buying this board which is not completely compatible (for the moment) with the current libraries for B4R.
Too bad because I managed to get the wifi going, connect the card to the internet and probably I would have easily (once the bread board arrived) to do some experiments with some LEDs, but the fact of not being able to go without problems LCD makes me crazy


I thank you very much for the help you have tried to give me and I wish you good luck for everything!

Thanks again.
 
Last edited:
Upvote 0

thetahsk

Active Member
Licensed User
Longtime User
now you can follow the second link from janderkan
 
Upvote 0

Bokka

Member
I have already tried to follow that discussion. The examples in the topic are no longer compatible with the new version of the library.

I still tried to write something myself quickly, but it doesn't work (compiled without problems but the display remains black without any text)

The AdafruitSSD1306 library is not compatble with ST7789V (I think).

The code is the following:

B4X:
Sub Process_Globals
    Public Serial1 As Serial
    Private st As AdafruitSSD1306

End Sub

Private Sub AppStart
    Serial1.Initialize(115200)
    Log("AppStart")
    st.InitializeHSPI(16, 23, 5)
    st.ClearDisplay 
    st.GFX.ConfigureText(1, st.WHITE, False)
    st.GFX.DrawText("Try text")
    st.Display
End Sub
 
Last edited:
Upvote 0

viriato

Member
Licensed User
Longtime User
Hi Bokka,
I just received the same board ESP32 TTGO T-Display same as yours
Have you been able to use it with B4R ?
if yes and if possible I will appreciate if you can share the code
Thank you
 
Upvote 0
Top