TINKER PIEDESIGN IN INDIA

Rainbow and JavaScript

Animate a rainbow, then look at the same program as JavaScript. Intermediate · 10 min

Start this tutorial in TinkerPie Studio

  1. Rainbow block

    From LED matrix, put rainbow, shifted by 0 ° inside forever.

  2. Make it move

    Create a variable hue. Drop it into the rainbow slot, then add change hue by 12 and pause (ms) 40.

  3. Run

    Press Run. The colours flow across all 30 LEDs.

  4. See the code

    Switch to JavaScript at the top. This is the exact code the board runs: led.rainbow(hue).

  5. Edit the code

    Change 12 to 30 and press Run. Typing led. shows every LED function with a short explanation.