Posted on

Decision Slug

Decision Slug at SHAK Makerspace         
Some days, you are just too much of a slug to make a decision.

When that happens, the decision slug is the project for you.

This slug was laid out with a 4 option grid, but you could build yours with any number of choices.

This was the first project I did in my August Month of MakerMayhem-  my personal locked out time to explore and build with hardware.   I have a long history with software and programming- but it has always been applications or web pages.  I had historically sidestepped making the step into hardware controls, maybe because I was Certain I was going to just explode expensive hardware, it seemed safe to stick to words on a screen.  When I decided to block off large chunks of time in August to make at SHAK Makerspace , this seemed like the right challenge to include.

Luckily, the Adafruit Circuit Playground Express is a super easy and reasonably low-cost board to start with- this took most of the trepidation out of the mix.

For the first project, I wanted to play with the accelerometer, built-in sound, the included neoPixels, and also with conductive thread and some connected LEDs ( I put those in the slug eyespots).

Although the Circuit Playground express can be programmed in a multitude of languages ( including CircuitPython and Arduino), I did this first project in Javascript.  I wanted to focus on the hardware and hardware calls, not learning a new language.

I kept track of every iteration of the code, just to see how many experimental rounds and tweaks it took me to get the results I had decided on.  12 iterative saves and about an hour later I had functioning code that I liked how it behaved both in the Microsoft MakeCode simulator and on the board itself.

You can see the code here, feel free to copy/paste and mutate for your own use.

let LED = 0
input.onGesture(Gesture.Shake, function () {
music.playSound(music.sounds(Sounds.PowerUp))
// Pick a random number, there are 10 LEDS on the CPE
LED = Math.randomRange(0, 9)
light.showAnimation(light.sparkleAnimation, __internal.__timePicker(2000))
// Blink the LED Eyes that are sewn in at outputs A7
// and A0
pins.A7.digitalWrite(true)
pins.A0.digitalWrite(true)
pins.A7.digitalWrite(false)
pins.A0.digitalWrite(false)
pins.A7.digitalWrite(true)
pins.A0.digitalWrite(true)
music.playSound(music.sounds(Sounds.BaDing))
light.setPixelColor(LED, 0x00ff00)
// Turn the eyes back off
pins.A7.digitalWrite(false)
pins.A0.digitalWrite(false)
})

Most of the iterations were because I  layered in the effects one at a time so I could learn and debug ( not really much to debug here) and then playing with order and timing to give the results I wanted.   If you like exactly this action, you can download the compiled code.

I then spent most of the rest of the day… sewing. I used scraps and bits we had around the space and made a goofy looking slug.
I think this would be fun to bastardize an existing stuffed animal and embed it into the animal, as a next level redo.

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.