Tip
Don’t forget to test out the light animation options!
light.showAnimation(light.rainbowAnimation, 500)
Concepts:
light.setAll(0xffff00)
light.setBrightness(input.soundLevel())
light.showAnimation(light.rainbowAnimation, 500)
Open MakeCode in your web browser.
From ||light:LIGHT||
, drag a ||light:set all pixels to||
block, and place it inside a ||input:on pin A1 click||
block.
input.pinA1.onEvent(ButtonEvent.Click, function () {
light.setAll(0xff0000)
})
Change the current color to one that you like.
From ||light:LIGHT||
, drag a ||light:set all pixels to||
block, and place it inside a ||input:on pin A2 click||
block. Code the same blocks for the other pins too: A3 - A6.
input.pinA2.onEvent(ButtonEvent.Click, function () {
light.setAll(0xfff000)
})
Set the color for each pin to one that you like (or choose some animations!).
Connect your Adafruit Circuit Playground Express to your computer’s USB port and click |Download|
.
Follow the instructions to move the code to your Adafruit Circuit Playground Express and test the pins.
Set the brightness value to make the pixels have a pleasant glow.
light.setBrightness(200)
||light:LIGHT||
drag a ||light:set brightnes||
block into the ||loops:on start||
block200
Download the code again to your Adafruit Circuit Playground Express and try touching the A1 - A6 pins.
Ready to do some craft you lamp?
NEXT: Start making!