Spine Straightener

by 102702 in Workshop > Home Improvement

90 Views, 1 Favorites, 0 Comments

Spine Straightener

Webp.net-gifmaker.gif

The device will light red when the user's spine is not straight.

Supplies:

  • CPX(Circuit Playground Express) with a battery pack
  • 3 small batteries
  • Non-conductive thread
  • Needle
  • Scissors(for cutting the needle)

Coding

Screenshot 2021-06-02 at 14.38.58.png

Upload the following Code to the CPX either through block code or by copy pasting the javascript provided.

input.buttonA.onEvent(ButtonEvent.Click, function () {
    if (mute == 1) {
        mute = 0
    } else {
        mute = 1
    }
})
let mute = 0
mute = 1
music.setVolume(255)
forever(function () {
    if (input.acceleration(Dimension.Z) < 50) {
        light.showRing(
            `green green green green green green green green green green`
        )
    } else {
        light.showRing(
            `red red red red red red red red red red`
        )
        if (mute == 1) {
            music.playTone(120, music.beat(BeatFraction.Breve))
        }
    }
})

The code will check for the incline of the Z-axis using the accelerometer on the CPX. If the value is too high, it lights red. By default, when it turns red, it continuously makes a sound, alerting the user. However this feature can be disabled by pressing the A button on the CPX.

Attach the CPX to the Battery Pack

20210506_140146.jpg
20210510_105422.jpg

Use non-conductive thread to attach the CPX to the battery pack. The thread can go through the pins on the CPX.

However, make sure that in the back all the thread doesn't go under the "belt" on the battery pack. Otherwise you won't be able to put it on a T-Shirt.

Try It Out

SmartSelect_20210510-110558_Video_Player.jpg
SmartSelect_20210510-110718_Video_Player.jpg

Attach the battery pack to your T-Shirt and turn on the switch on the battery pack.