Using Different Inputs

By default this MakeCode example is set up to use the A button as a trigger, but it is easy to use other inputs to trigger your box.

Try it out! https://makecode.adafruit.com/49951-32099-41050-46072

Perhaps you want Blinka to pop our of her box as soon as someone enters a room and turns on the light? Easy! Click the pink "Input" button and drag the "on light dark" into the code space. You can use the dropdown menu on this block to change it to respond to sudden bright light instead of sudden darkness. 

Now drag the whole block of code into your new "on light bright" trigger.

Uploading New Code

To replace your old code with this new version, download the updated .uf2 file.

It is sometimes helpful to rename your code so you don't get confused which version is which.

BUT WHERE'S MY CPLAYBOOT? 

Make sure your CPX is connected to your computer, then press the reset button in the center of the board again. The board should flash red and then go green. This means it's ready to accept new code.

Drag and drop your fresh .uf2 file onto the CPLAYBOOT drive and like magic it will automatically update & eject itself.

Done! Blinka will now respond to a sudden bright light instead of the button press.

You use different inputs to get Blinka to react to a loud sound or a sudden shake, just by dragging the code into a different input block!

If you want to continue exploring you can check out lots more MakeCode projects on the Adafruit Learn System:

https://learn.adafruit.com/category/makecode

 

This guide was first published on May 07, 2018. It was last updated on May 07, 2018.
This page (Exploring Further) was last updated on Aug 01, 2020.