Alex Beck
Created February 18, 2020

DNC Protest Object

A political satire object that mocks the Democratic National Conventions treatment of a particular candidate

12
DNC Protest Object

Things used in this project

Hardware components

Circuit Playground Express
Adafruit Circuit Playground Express
×1
Alligator Clips
Alligator Clips
×1
Toggle Switch, SPDT
Toggle Switch, SPDT
×1

Story

Read more

Code

DNCProtestCode

JavaScript
input.buttonA.onEvent(ButtonEvent.Click, function () {
    Test = true
})
input.buttonB.onEvent(ButtonEvent.Click, function () {
    control.reset()
})
let Test = false
let list: number[] = []
pins.A0.setPull(PinPullMode.PullUp)
pins.A1.setPull(PinPullMode.PullUp)
pins.A2.setPull(PinPullMode.PullUp)
pins.A3.setPull(PinPullMode.PullUp)
pins.A4.setPull(PinPullMode.PullUp)
pins.A5.setPull(PinPullMode.PullUp)
pins.A6.setPull(PinPullMode.PullUp)
pins.A7.setPull(PinPullMode.PullUp)
Test = false
music.setVolume(255)
let A0 = true
let A1 = true
let A2 = true
let A3 = true
let A4 = true
let A5 = true
let A6 = true
let A7 = true
forever(function () {
    if (!(pins.A0.digitalRead())) {
        light.setAll(0x00ff00)
        while (Test == true) {
            if (A0 == true) {
                let Biden = 0
                music.playMelody("F A - - - - - - ", 120)
                list.push(Biden)
                A0 = false
            }
        }
    } else if (!(pins.A1.digitalRead())) {
        light.setAll(0xff0000)
        while (Test == true) {
            if (A1 == true) {
                music.playMelody("D C - - - - - - ", 120)
                A1 = false
            }
        }
    } else if (!(pins.A2.digitalRead())) {
        light.setAll(0x0000ff)
        while (Test == true) {
            if (A2 == true) {
                let Buttigieg = 0
                music.playMelody("F A - - - - - - ", 120)
                list.push(Buttigieg)
                A2 = false
            }
        }
    } else if (!(pins.A3.digitalRead())) {
        light.setAll(0xff0000)
        while (Test == true) {
            if (A3 == true) {
                music.playMelody("D C - - - - - - ", 120)
                A3 = false
            }
        }
    } else if (!(pins.A4.digitalRead())) {
        light.setAll(0xffff00)
        while (Test == true) {
            if (A4 == true) {
                let Yang = 0
                music.playMelody("F A - - - - - - ", 120)
                list.push(Yang)
                A4 = false
            }
        }
    } else if (!(pins.A5.digitalRead())) {
        light.setAll(0xff0000)
        while (Test == true) {
            if (A5 == true) {
                music.playMelody("D C - - - - - - ", 120)
                A5 = false
            }
        }
    } else if (!(pins.A6.digitalRead())) {
        light.setAll(0x7f00ff)
        while (Test == true) {
            if (A6 == true) {
                let Warren = 0
                music.playMelody("F A - - - - - - ", 120)
                list.push(Warren)
                A6 = false
            }
        }
    } else if (!(pins.A7.digitalRead())) {
        light.setAll(0xff0000)
        while (Test == true) {
            if (A7 == true) {
                music.playMelody("D C - - - - - - ", 120)
                A7 = false
            }
        }
    } else {
        light.clear()
    }
})

Credits

Alex Beck
4 projects • 0 followers

Comments