Giovanni Minus
Created January 28, 2020 © GPL3+

Project 1: Switches and Knobs- Giovanni Minus

A "TV stand" made out of paper and plastic. Has a simple switch to the left that turns it on/off and plays music. Watch the cartoon.

BeginnerShowcase (no instructions)1 hour11
Project 1: Switches and Knobs- Giovanni Minus

Things used in this project

Hardware components

Circuit Playground Express
Adafruit Circuit Playground Express
×1

Software apps and online services

MakeCode
Microsoft MakeCode

Story

Read more

Schematics

Video Showcase

TV Stand Construction 1

TV Stand Construction 2

TV Stand Construction 3

TV Stand Construction Final

Makeshift Block Code

Code

Project Code

JavaScript
One part of the code plays when the switch connected to the A3 pin turns off, another part of the code plays when the switch is turned on. When turned on it constantly plays music and turns all the lights to blue. When turned off it stops any playing music right away and turns all the lights off except for one little red light.
let power = false
input.pinA3.onEvent(ButtonEvent.Up, function () {
    power = true
    light.setAll(0x00ffff)
    while (power == true) {
        music.playMelody("B A G A G F A C5 ", 80)
    }
})
input.pinA3.onEvent(ButtonEvent.Down, function () {
    power = false
    music.stopAllSounds()
    light.setBrightness(10)
    light.showRing(
    `black black red black black black black black black black`
    )
})

Credits

Giovanni Minus
3 projects • 0 followers
Contact

Comments

Please log in or sign up to comment.