![]() |
Forum Index : Microcontroller and PC projects : WS2812B LED with picoMite questions
![]() ![]() |
|||||
Author | Message | ||||
AlbertR Newbie ![]() Joined: 29/05/2025 Location: GermanyPosts: 12 |
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: GermanyPosts: 558 |
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: GermanyPosts: 12 |
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: GermanyPosts: 558 |
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: GermanyPosts: 12 |
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: GermanyPosts: 12 |
sorry forgot upload ALedMatrixTests.zip |
||||
AlbertR Newbie ![]() Joined: 29/05/2025 Location: GermanyPosts: 12 |
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 |
||||
![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |