Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 13:06 19 Jun 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : WS2812B LED with picoMite questions

     Page 2 of 2    
Author Message
AlbertR
Newbie

Joined: 29/05/2025
Location: Germany
Posts: 12
Posted: 07:32am 01 Jun 2025
Copy link to clipboard 
Print this post

Daniel
I made a new version
because of the time for the loop I made some unrolling and precalculations like the first version. Additional there is a third string for a rest period

LedMatrixR.zip

have fun with it

Greetings
Albert
 
Amnesie
Guru

Joined: 30/06/2020
Location: Germany
Posts: 558
Posted: 11:01am 01 Jun 2025
Copy link to clipboard 
Print this post

Albert,

this is so impressive to see your new video! Currently my ordered modules are on their way to Germany ... so I have to be patient  

You connected 5 modules? Do you know what the current draw is? I suppose I have to order an additional power supply for that. But that's not a problem.

Thanks for your updated version, as soon as I tried them out I will report. But it is just amazing to see what MMBASIC is capable of! A lot of fun ahead!

Greetings
Daniel
Edited 2025-06-01 21:01 by Amnesie
 
AlbertR
Newbie

Joined: 29/05/2025
Location: Germany
Posts: 12
Posted: 09:19am 05 Jun 2025
Copy link to clipboard 
Print this post

i made an other version loading a bmp directly without display
max. 4 tiles of 8x8 are visible


' get led-data from bmp-file
' 11  4 byte offBits
' 19  4 byte biWidth
' 23  4 byte biHeight
Option DEFAULT NONE
Option EXPLICIT

Dim Integer tmp(8) 'Dim Leds follows later when size is known
Dim Integer lAdr,tAdr
Dim Integer offBits,biWidth,biHeight
Dim Integer x,y,fill,mCnt,lCnt

' sys-init
SetPin GP0, DOUT       'outputpin for the first  ws2812-matrix

'Drive "B:"
Open "MPTeaCup.bmp" For random As #1
 '- read parts of bmp-header
 Seek #1,11                'skip type("BM"),size,reserved
  offBits  = ReadDWord()
 Seek #1,19                'skip headersize
  biWidth  = ReadDWord()
  biHeight = ReadDWord()
 '- read bmp-data
 Dim Integer Leds(biWidth*biHeight) 'Array for bmp-data
 Seek #1,offBits+1         'skip planes, bitcount, compress, ...
 For y = 0 To biHeight-1
   For x = 0 To biWidth-1
     Leds((x*biHeight)+y)= ReadPixel() '3 bytes BGR-values divided by 8
   Next x
   fill = 3-Loc(#1)And 3   'mask last 2 bit to fill up to 4-byte boundary/line
   If fill>0 Then = Asc(Input$(fill,#1)) 'skip dummy-data
 Next y
Close #1

lAdr = Peek(VarAddr Leds()) 'adr of led-data
tAdr = Peek(VarAddr tmp())  'adr of temp-data

mCnt = biWidth*8            'in pixel
If mCnt>256 Then lCnt=256 Else lCnt=mCnt    'max Ws2812 bitbang
'- main loop -----------------------------------------------------
Do
 Device WS2812 B, GP0, lCnt, Leds()        'sys-function
 Memory Copy Integer lAdr,tAdr,8           'copy 1 column(8pix) to temp buffer
 Memory Copy Integer lAdr+(64),lAdr,mCnt-8 'move all from second to last column
 Memory Copy Integer tAdr,lAdr+(mCnt-8)*8,8'copy temp buffer in last column
 Pause 60
Loop

'- functions ------------------------------------------------------
Function ReadPixel() As Integer
Local integer Bl,Gr,Re
 Bl=Asc(Input$(1,#1))>>3
 Gr=Asc(Input$(1,#1))>>3
 Re=Asc(Input$(1,#1))>>3
 ReadPixel = (Re<<16)+(Gr<<8)+Bl
End Function

Function ReadDWord() As Integer
Local integer lsb,msb,msb1,msb2
 lsb =Asc(Input$(1,#1))
 msb =Asc(Input$(1,#1))
 msb1=Asc(Input$(1,#1))
 msb2=Asc(Input$(1,#1))
 ReadDWord = (msb2<<24)+(msb1<<16)+(msb<<8)+lsb
End Function


Greetings
Albert

Footnote added 2025-06-05 20:55 by AlbertR
by checking i discover a mistake

If fill>0 Then = Asc(Input$(fill,#1)) 'skip dummy-data
must be changed to
If fill>0 Then x = Asc(Input$(fill,#1)) 'skip dummy-data

the bmp-file must be 24bit with a Height of 8 pixel
 
Amnesie
Guru

Joined: 30/06/2020
Location: Germany
Posts: 558
Posted: 10:35am 05 Jun 2025
Copy link to clipboard 
Print this post

Hello Albert,

sadly I am still waiting for my 8x8 matrix from china. At the time I only have a 4x4 matrix. But a 8x8 does make more sense.

It is possible to show an bmp? I didn't expect that to work! Wow! There is a lot I have to play with, as soon as my new modules arrive    

Greetings
Daniel
 
AlbertR
Newbie

Joined: 29/05/2025
Location: Germany
Posts: 12
Posted: 11:37am 05 Jun 2025
Copy link to clipboard 
Print this post

Hello Daniel,

i made a quick hack and a sample bmp for you for 4x4 display
don't know if it works correct.

Greetings
Albert
 
AlbertR
Newbie

Joined: 29/05/2025
Location: Germany
Posts: 12
Posted: 11:38am 05 Jun 2025
Copy link to clipboard 
Print this post

sorry forgot upload
ALedMatrixTests.zip
 
AlbertR
Newbie

Joined: 29/05/2025
Location: Germany
Posts: 12
Posted: 06:44pm 06 Jun 2025
Copy link to clipboard 
Print this post

Hello,

I made a new one, now with some layers to implement 3 bmps with different scrolling.

@Bill, I captured the theme of your project, now with scrolling background and falling snowflakes.


LedMatrix.zip


Greetings
Albert
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025