It is a B4R wrap for this Github Project.
See this post for wiring diagram
https://www.b4x.com/android/forum/threads/sevseg-with-inline-c.106952/
I am using a 4 dig x 7 segment display SMA420364L (hard wired i.e no display controller)
".....This library allows an Arduino to easily display numbers and characters on a 4 digit 7-segment display without a separate 7-segment display controller. It works for any digital pin arrangement, common anode and common cathode displays. It also has character support including letters A-F and many symbols.
Hardware Setup
4 digit 7 segment displays use 12 digital pins. You may need more pins if your display has colons or apostrophes.
There are 4 digit pins and 8 segment pins. Digit pins are connected to the cathodes for common cathode displays, or anodes for common anode displays. 8 pins control the individual segments (seven segments plus the decimal point)....."
Library files (rSevSeg.zip) attached. Add the extracted folder to your additional libs folder and place the xml in the root of your additional libs folder.
Sample project attached (enable rSevSeg in the libs tab of the B4R IDE)
Sample Code:
See this post for wiring diagram
https://www.b4x.com/android/forum/threads/sevseg-with-inline-c.106952/
I am using a 4 dig x 7 segment display SMA420364L (hard wired i.e no display controller)
".....This library allows an Arduino to easily display numbers and characters on a 4 digit 7-segment display without a separate 7-segment display controller. It works for any digital pin arrangement, common anode and common cathode displays. It also has character support including letters A-F and many symbols.
Hardware Setup
4 digit 7 segment displays use 12 digital pins. You may need more pins if your display has colons or apostrophes.
There are 4 digit pins and 8 segment pins. Digit pins are connected to the cathodes for common cathode displays, or anodes for common anode displays. 8 pins control the individual segments (seven segments plus the decimal point)....."
Library files (rSevSeg.zip) attached. Add the extracted folder to your additional libs folder and place the xml in the root of your additional libs folder.
Sample project attached (enable rSevSeg in the libs tab of the B4R IDE)
Sample 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
Dim svg As SevSeg
Dim t As Timer
Dim cnt As Byte = 0
End Sub
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
svg.initialize
t.Initialize("t_tick", 20)
svg.Begin(svg.CommonCathode, 4, 13, 12, 11, 10, 2, 3, 4, 5, 6, 7, 8, 9)
Delay(10)
svg.SetBrightness(75)
Delay(10)
t.Enabled = True
End Sub
Sub t_tick
cnt = cnt + 1
If cnt <= 127 Then
Dim data() As Byte = "1234"
svg.DisplayB4RByteArray(data, 0)
else if cnt <= 255 Then
Dim mystring As String = "5678"
svg.DisplayB4RString(mystring, 0)
End If
If cnt = 255 Then
cnt = 0
End If
End Sub
Attachments
Last edited: