Share My Creation [B4x] LED Matrix

This is a Custom view b4xlib that I created to add to my LogServer, I though it may come in handy for other purposes so I'd share it here.
You can have any number of channels (Rows) and a practical limit of 32 LED's (Columns) per channel as the state for each channel is stored in an Int, which is a 32 Bit variable. If you really want more you can change the State variable to a Long and then get up to 64


upload_2019-12-20_11-35-28.png



Documentation:

LEDMatrix

Author: Stevel05
Version:
1.00
  • LEDMatrix
    • Functions:
      • DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
        Base type must be Object
      • Initialize (Callback As Object, EventName As String)
      • Overlay_Touch (Action As Int, X As Float, Y As Float)
      • SetLEDState (Channel As Int, LEDIndex As Int, SetOn As Boolean)
        LED index is 0 - no of Leds from Right (LSB) to Left (MSB)
      • SetLEDStates (Channel As Int, State As Int)
        Set the state for a channel (Row)
        The LED's are configured to display a bit value, setting the state to 0 turns off the channel
        A State of 1 turns on the LED representing the Least Significant bit (LSB) (Rightmost LED)
        A State of 128 (Presuming you have 8 LED's) will turn on the LED representing the Most Significant Bit (MSB) (Leftmost LED)
        A State of 255 will turn on all LED's in the channel
    • Properties:
      • Base As B4xView
      • BackgroundColour
      • ChannelCount
      • LedCount
      • LEDInsetColour
      • LEDMode As String
        Get/Set The LEDMode which can be "Pulse" Or "Latch" :
        Pulse will show for the set Duration, Latch will display until explicitly turned off
      • LEDOffColour
      • LEDOnColour
      • PulseDuration
      • ShortNames As String [write only]
        Set the shortnames to be displayed on the view order MSB to LSB
      • TextColour
      • TooTipText As String [write only]
        Set the Tooltip / Toast text to be displayed on the view order MSB to LSB

There are demo apps for B4j and B4a, I don't know if it will work for B4i, if you want to try it you will need to edit the manifest in the b4xlib.

It will help if you know, or are willing to learn, how to manipulate bits with the Bit Command.

Let me know how you get on with it.
 

Attachments

  • LEDMatrixTest-B4a.zip
    9.6 KB · Views: 368
  • LEDMatrixTest-B4j.zip
    2.5 KB · Views: 383
  • LEDMatrix.b4xlib
    3.4 KB · Views: 371
Last edited:

stevel05

Expert
Licensed User
Longtime User
Of Course, my mistake :(
 
Top