SciJoy
Published

Counting Punches with Circuit Playground Express

Count punches or weight repetitions with Circuit Playground Express.

BeginnerFull instructions provided30 minutes967
Counting Punches with Circuit Playground Express

Things used in this project

Hardware components

Circuit Playground Express
Adafruit Circuit Playground Express
×1
4xAA battery holder
4xAA battery holder
Any kind of battery you want to use power the CPE board.
×1

Software apps and online services

MakeCode
Microsoft MakeCode

Story

Read more

Schematics

CPE board and battery

Code

The link in the comment section is to the MakeCode version.

JavaScript
https://makecode.com/_PvChHzdPmdgb
let reps = 0
let Set = 0
let Punch = 0
input.onGesture(Gesture.ThreeG, function () {
    light.setPixelColor(Punch, 0x7f00ff)
    Punch += 1
    if (Punch == reps) {
        light.showRing(
        `black black black black black black black black black black`
        )
        Punch = 0
        for (let index = 0; index <= Set; index++) {
            light.setPixelColor(index, 0xff0000)
        }
        Set += 1
    }
    if (Set == 10) {
        music.playSound(music.sounds(Sounds.Siren))
        Punch = 0
        Set = 0
        light.showRing(
        `black black black black black black black black black black`
        )
    }
})
Punch = 0
Set = 0
reps = 5

Credits

SciJoy

SciJoy

7 projects • 15 followers
We run a YouTube channel where we share what we are learning and building with others.

Comments