Hallo,
habe gerade etwas mit 5 Metern LED Stripe mit dem APA102 probiert...
Wichtig:
LED Anzahl muss stimmen, sonst treten Effekte auf
Stromversorgung muss an beiden Enden angeschlossen sein
Wenn alle LED's an sind auf voller Helligkeit braucht der Streifen bei 5V ca. 12 Ampere
gekauft:
https://www.amazon.de/gp/product/B01CZUF8K4

Bei Fragen und Ideen zur Weiterentwicklung könnt ihr euch gerne melden.
Pläne: Digitale Uhr mit Überblendung Equalizer für Musik....

Code:
'-----------------------------------------------------------------------------------------
'name                     : DotStar APA 102
'purpose                  : demo
'micro                    : Mega8
'suited for demo          : yes
'commercial addon needed  : no
'-----------------------------------------------------------------------------------------

$regfile = "m8def.dat"                                      ' specify the used micro
$crystal = 8000000
$hwstack = 32
$swstack = 8
$framesize = 24
$baud = 9600

Dim I As Integer
Dim J As Integer
Dim K As Integer
const LEDANZ = 278                                          'Muss passen
dim LED_COL(LEDANZ)as Byte
dim LED_ON(LEDANZ)as Byte

dim R_Array(16) AS byte
dim G_Array(16) AS byte
dim B_Array(16) AS byte


'Black
R_Array(1) = 0
G_Array(1) = 0
B_Array(1) = 0
'          White
R_Array(2) = 255
G_Array(2) = 255
B_Array(2) = 255
'          Red
R_Array(3) = 255
G_Array(3) = 0
B_Array(3) = 0
'          Lime
R_Array(4) = 0
G_Array(4) = 255
B_Array(4) = 0
'          Blue
R_Array(5) = 0
G_Array(5) = 0
B_Array(5) = 255
'          Yellow
R_Array(6) = 255
G_Array(6) = 255
B_Array(6) = 0
'          Cyan / Aqua
R_Array(7) = 0
G_Array(7) = 255
B_Array(7) = 255
'          Magenta / Fuchsia
R_Array(8) = 255
G_Array(8) = 0
B_Array(8) = 255
'          Silver
R_Array(9) = 192
G_Array(9) = 192
B_Array(9) = 192
'          Gray
R_Array(10) = 28
G_Array(10) = 28
B_Array(10) = 28
'          Maroon
R_Array(11) = 28
G_Array(11) = 0
B_Array(11) = 0
'          Olive
R_Array(12) = 28
G_Array(12) = 28
B_Array(12) = 0
'          Green
R_Array(13) = 0
G_Array(13) = 28
B_Array(13) = 0
'          Purple
R_Array(14) = 28
G_Array(14) = 0
B_Array(14) = 28
'          Teal
R_Array(15) = 0
G_Array(15) = 28
B_Array(15) = 28
'          Navy
R_Array(16) = 0
G_Array(16) = 0
B_Array(16) = 28


Config Spi = Hard , Master = Yes , Data_order = Msb         'Is serial clock SCL
Spiinit

Dim Ledon As Integer

LEDon = 0
'for i = 1 to LEDANZ
'    LED_Col(i) = 2
'    next i
'for i = 1 to 32
'    LED_Col(i) = 0
'    next i

gosub LED_Clear

Do
   'Lauflicht Bunt  ****************************************
'    for i = 1 to 16
'       LED_Col(i) = i
'       LED_ON(i) = 1
'      next i
'    for i = 1 to 1000
'       gosub LED_RUNRight
'       waitms 20
'       next i
'    'Lauflicht Bunt ***************************************

    'Weiss Langsam an *************************************
'    for j = 1 to LEDANZ
'        LED_Col(j) = 2
'        LED_On(j) = 1
'        for i = 2 to 31
'             k = j - i
'            if k > 1 then
'               k = j - i
'               LED_On(k) = i
'               end if
'        next i

'        gosub LED_write
'        waitms 10
'        next j
'    gosub LED_TURNON
'    Waitms 4000
'    gosub LED_Clear
'    Waitms 4000
    'Weiss Langsam an *************************************



   'Lauflicht Weiss ***************************************
   for i = 1 to LEDANZ
       LED_COL(i) = 1
       next i
   for i = 1 to LEDANZ
       LED_ON(i) = 0
       next i
   LED_COL(LEDON) = 2
   LED_ON(LEDON) = 31
   gosub LED_write
'   'ende Lauflicht Weiss *********************************


Incr Ledon
If Ledon > LEDANZ Then Ledon = 0


Loop
End


LED_Write:
Dim Ledframe(4) As Byte
dim ii as word , jj as word
Dim Aus as Byte
Ledframe(1) = 0
Ledframe(2) = 0
Ledframe(3) = 0
Ledframe(4) = 0
For Ii = 0 To 3
     Spiout Ledframe(1) , 4                                        'StartFrame
     Next Ii

For Ii = 1 To LEDANZ
    Ledframe(1) = LED_ON(II) or &B11100000                  'MSB LSB
    LEDFrame(2) = B_Array(LED_COL(II))                      'Blue
    LEDFrame(3) = G_Array(LED_COL(II))                      'Green
    LEDFrame(4) = R_Array(LED_COL(II))                      'Red
    Spiout LEDframe(1) , 4
    Next Ii
jj = LEDANZ / 2
For Ii = 1 To jj
     Aus = &B11111111                                       'EndFrame
     Spiout Aus , 1
    Next Ii
return
'Ende LED_write



LED_Clear:
dim LED_Count as word
for LED_Count = 1 to LEDANZ
    LED_ON(LED_Count) = 0
    LED_COL(LED_Count) = 1
    next LED_Count
gosub LED_Write
return


LED_TurnOn:
for LED_Count = 1 to LEDANZ
    LED_ON(LED_Count) = 31
    next LED_Count
gosub LED_Write
return

LED_RUNRight:
dim III as Word
dim temp as word , temp1 as word
temp = LED_COL(1)
for III = 1 to LEDANZ
    temp1 = LED_COL(III + 1)
    LED_COL(III) = temp1
    next III
LED_COL(LEDANZ) = temp
temp = LED_ON(1)
for III = 1 to LEDANZ
    temp1 = LED_ON(III + 1)
    LED_ON(III) = temp1
    next III
LED_ON(LEDANZ) = temp
gosub LED_Write
return