Ośmiornica reaguje na beaty muzyki i nawet zmienia randomowo scenariusz interpretacji, ale ... jak w klubie czasem jest cisza to włącza tryb "snowflakes" ":D
Efekt wygląda tak że czasem losowy piksel rozpali się na maks tak że błysnie a potem gaśnie pomału. Słowo losowy ma tu duze znaczenie. Im więcej ledów WS tym bardziej to randomowo rozpala czasem jakiś piksel tk jakby spadł tam płatek śniegu.
Mam dwa telefony i jak przeczytacie niezbyt drogie/ambitne. Pierwszy iPhone SE nie jest w stanie nagrać tego efektu. Wygasza te sparki na nagraniu i nie widac efektu. Drugi telefon Redmi 7A nagrał to tak jak mógł nagrać, ale obiecuję że to nie jest to co naprawdę ten efekt pokazuje.
link do ostatniego filmiku Redmi7A -> LINK
link do filmu gdzie sofware pracuje z AGC (automatic gain control) i wyszukiwaniem ciszy i wtedy automatycznie swflake_effect ->LINK
No i kod do tego efektu
Code: [Zaznacz cały] [Rozwiń/Zwiń]
- $regfile = "m328pdef.dat"
- $crystal = 16000000
- $hwstack = 64
- $swstack = 32
- $framesize = 128
- $baud = 115200
- Const Number_of_leds = 45
- '*******************************************************
- '* TIMER SETTINGS FOR TIME BASE *
- '*******************************************************
- Config Timer0 = Timer , Prescale = 1024 , Clear_timer = 1
- 'Compare0a = 124 '2ms @16MHz/256
- Compare0a = 77 '5ms @16MHz/1024
- 'Compare0a = 155 '10ms @16MHz/1024
- '*******************************************************
- '* MULTIPURPOSE VARIABLES *
- '*******************************************************
- Dim Helpb As Byte , N As Byte
- '*******************************************************
- '* RAINBOWLEDS SETTINGS *
- '*******************************************************
- Config Rainbow = 1 , Rb0_len = Number_of_leds , Rb0_port = Portc , Rb0_pin = 0
- Rb_selectchannel 0 'wybierz kanal
- Rb_clearcolors : Rb_send 'i czysc po reset
- Dim Color(3) As Byte
- Const Snow_max = 20
- Dim Numleds As Byte
- Dim Flash As Byte , Sparked As Byte
- Dim Los As Byte , Active As Byte , Running As Byte
- Dim Wait_time As Byte , Countdown As Byte
- Dim Spark(3) As Byte
- Spark(1) = &HFF
- Spark(2) = &HFF
- Spark(3) = &HFF
- Dim Heat(255) As Byte
- Numleds = Number_of_leds
- Do
- If Tifr0.ocf0a = 1 Then
- Tifr0.ocf0a = 1
- If Running = 0 Then
- Running = 1
- Color(1) = Snow_max
- Color(2) = Snow_max
- Color(3) = Snow_max ' define a color
- For N = 0 To Numleds -1
- Rb_setcolor N , Color(1)
- Next
- Else
- If Flash = 1 Then
- Flash = 0
- Rb_setcolor Sparked , Color(1)
- 'Rb_send
- End If
- Helpb = Rnd(5)
- If Helpb > 0 Then
- Los = Rnd(numleds)
- Color(1) = Rb_getcolor(los)
- Helpb = Color(1)
- Select Case Heat(los)
- Case 0
- 'If Active < Numleds Then
- Heat(los) = 1
- 'Incr Active
- 'End If
- Case 1
- If Helpb > 0 Then
- Decr Helpb
- Color(1) = Helpb
- Color(2) = Helpb
- Color(3) = Helpb
- Rb_setcolor Los , Color(1)
- 'Rb_send
- Else
- Heat(los) = 2
- End If
- Case 2
- If Color(1) < Snow_max Then
- Helpb = Rnd(snow_max)
- Helpb = Helpb / 4
- Color(1) = Color(1) + Helpb
- If Color(1) > Snow_max Then
- Color(1) = Snow_max
- End If
- Color(2) = Color(1)
- Color(3) = Color(1)
- Rb_setcolor Los , Color(1)
- 'Rb_send
- Else
- Heat(los) = 0
- If Active > 0 Then Decr Active
- End If
- End Select
- End If
- End If
- Rb_send
- If Countdown > 0 Then
- Decr Countdown
- Else
- '-------------------------------------------[SNOW]--
- 'time to time spark one pixel
- If Running = 1 Then
- Sparked = Rnd(numleds)
- Color(1) = Rb_getcolor(sparked)
- Rb_setcolor Sparked , Spark(1)
- Rb_send
- Wait_time = Rnd(200)
- Flash = 1
- End If
- Countdown = Wait_time
- End If
- 'end if 2ms
- End If
- Loop