Frau Hmpf
Published © GPL3+

Princess Leia's Blaster

Big shout out for all the ladies who are no damsels in distress but would rather like to have a blast with a blaster and the micro:bit.

BeginnerFull instructions provided3 hours2,036
Princess Leia's Blaster

Things used in this project

Hardware components

BBC micro:bit board
BBC micro:bit board
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1
Speaker: 0.25W, 8 ohms
Speaker: 0.25W, 8 ohms
×1
NeoPixel strip
NeoPixel strip
I've used a 8-LED stick.
×1
Princess Leia Blaster
×1
Jumper wires (generic)
Jumper wires (generic)
×1
2AA Battery Holder for RTC
UDOO 2AA Battery Holder for RTC
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

Schematics

screenshot from the microsoft editor

Code

Leias Blaster

JavaScript
https://makecode.microbit.org/_1bAc4xbfpRm4
let strip: neopixel.Strip = null
input.onButtonPressed(Button.A, () => {
    music.playTone(220, music.beat(BeatFraction.Whole))
    music.playTone(220, music.beat(BeatFraction.Whole))
    music.playTone(370, music.beat(BeatFraction.Whole))
    music.playTone(370, music.beat(BeatFraction.Double))
    music.rest(music.beat(BeatFraction.Quarter))
    music.playTone(370, music.beat(BeatFraction.Half))
    music.playTone(392, music.beat(BeatFraction.Whole))
    music.playTone(392, music.beat(BeatFraction.Half))
    music.rest(music.beat(BeatFraction.Eighth))
    music.playTone(370, music.beat(BeatFraction.Half))
    music.playTone(330, music.beat(BeatFraction.Double))
    music.rest(music.beat(BeatFraction.Quarter))
    music.playTone(220, music.beat(BeatFraction.Whole))
    music.playTone(220, music.beat(BeatFraction.Whole))
    music.playTone(370, music.beat(BeatFraction.Whole))
    music.playTone(370, music.beat(BeatFraction.Double))
    music.rest(music.beat(BeatFraction.Half))
    music.playTone(440, music.beat(BeatFraction.Half))
    music.playTone(466, music.beat(BeatFraction.Whole))
    music.playTone(466, music.beat(BeatFraction.Half))
    music.rest(music.beat(BeatFraction.Eighth))
    music.playTone(440, music.beat(BeatFraction.Half))
    music.playTone(392, music.beat(BeatFraction.Double))
    music.rest(music.beat(BeatFraction.Half))
})
input.onGesture(Gesture.TiltRight, () => {
    strip = neopixel.create(DigitalPin.P1, 8, NeoPixelMode.RGBW)
    strip.setBrightness(200)
    strip.setPixelColor(0, neopixel.colors(NeoPixelColors.Red))
    strip.show()
    basic.pause(100)
    strip.shift(1)
    strip.setPixelColor(1, neopixel.colors(NeoPixelColors.Red))
    strip.show()
    basic.pause(100)
    strip.shift(1)
    strip.setPixelColor(2, neopixel.colors(NeoPixelColors.Red))
    strip.show()
    basic.pause(100)
    strip.shift(1)
    strip.setPixelColor(3, neopixel.colors(NeoPixelColors.Red))
    strip.show()
    basic.pause(100)
    strip.shift(1)
    strip.setPixelColor(4, neopixel.colors(NeoPixelColors.Red))
    strip.show()
    basic.pause(100)
    strip.shift(1)
    strip.setPixelColor(4, neopixel.colors(NeoPixelColors.Red))
    strip.show()
    basic.pause(80)
    strip.shift(1)
    strip.setPixelColor(6, neopixel.colors(NeoPixelColors.Purple))
    strip.show()
    basic.pause(70)
    strip.shift(1)
    strip.setPixelColor(7, neopixel.colors(NeoPixelColors.Purple))
    strip.show()
    strip.clear()
})

Credits

Frau Hmpf

Frau Hmpf

3 projects • 16 followers
working where the wild things are a.k.a. teacher @ primary school

Comments