Byron Bess
Created February 18, 2020

Vote Counter

An easier way to count votes visually!

11
Vote Counter

Story

Read more

Schematics

Schematics for project

With the creative use for legos, i made the ability for this to be hand held and on the go.

Code

Photon Counter

JavaScript
Original code goes to the "MakeCode Minute: Photon Counter" by Adfruit industries. The code has it to when either button A or B is pressed, it will reveal a color.
let Counter = 0
input.buttonA.onEvent(ButtonEvent.Click, function () {
    Counter = Counter + 0
    music.playTone(262, music.beat(BeatFraction.Eighth))
    light.setPhotonPenHue(10)
    light.setPhotonMode(PhotonMode.PenDown)
    light.photonForward(-1)
    light.setPhotonMode(PhotonMode.PenUp)
    light.photonForward(2)
})
input.buttonB.onEvent(ButtonEvent.Click, function () {
    Counter = Counter + 0
    music.playTone(262, music.beat(BeatFraction.Eighth))
    light.setPhotonPenHue(176)
    light.setPhotonMode(PhotonMode.PenDown)
    light.photonForward(-1)
    light.setPhotonMode(PhotonMode.PenUp)
    light.photonForward(2)
})
forever(function () {
    if (Counter == 10) {
        Counter = 0
        light.setAll(0x0000ff)
    }
})

Credits

Byron Bess
3 projects • 0 followers

Comments