Rainbow and JavaScript
Animate a rainbow, then look at the same program as JavaScript. Intermediate · 10 min
Start this tutorial in TinkerPie Studio
Rainbow block
From LED matrix, put
rainbow, shifted by 0 °insideforever.Make it move
Create a variable
hue. Drop it into the rainbow slot, then addchange hue by 12andpause (ms) 40.Run
Press Run. The colours flow across all 30 LEDs.
See the code
Switch to JavaScript at the top. This is the exact code the board runs:
led.rainbow(hue).Edit the code
Change
12to30and press Run. Typingled.shows every LED function with a short explanation.