Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Santiago Vega
Published

DIG 3602 Project 3: Sensor Shower

Have you ever wanted to have the experience of having a shower without getting wet or naked? Well then, we have the solution for you!

BeginnerFull instructions provided3 hours655
DIG 3602 Project 3: Sensor Shower

Things used in this project

Hardware components

Circuit Playground Express
Adafruit Circuit Playground Express
×2
Alligator Clips
Alligator Clips
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1
Rechargeable Battery, Lithium Ion
Rechargeable Battery, Lithium Ion
×1

Software apps and online services

MakeCode
Microsoft MakeCode

Hand tools and fabrication machines

Scissor, Electrician
Scissor, Electrician
Tape, Electrical
Tape, Electrical
Tape, Velcro® Stick On Tape/Strip
Tape, Velcro® Stick On Tape/Strip

Story

Read more

Schematics

Layout of Shower Head CPX

This is the layout of the CPX we used for the shower head.

Code

CPX Receiving Code

JavaScript
This is the code that will allow the CPX's to receive signals from each other.
// THIS CODE IS FOR RECEIVING IR SIGNALS

input.buttonsAB.onEvent(ButtonEvent.Click, function () {
    light.clear()
})
network.onInfraredReceivedNumber(function (num) {
    if (num == 1) {
        light.showRing(
        "red red red red red red red red red red"
        )
    } else if (num == 2) {
        light.showRing(
        `blue blue blue blue blue blue blue blue blue blue`
        )
    } else if (num == 3) {
        light.showRing(
        `white white white white white white white white white white`
        )
        crickit.servo1.setAngle(0)
        pause(200)
        crickit.servo1.setAngle(180)
        pause(200)
        crickit.servo1.setAngle(0)
        pause(200)
        crickit.servo1.setAngle(180)
        pause(200)
        crickit.servo1.setAngle(0)
        pause(200)
        crickit.servo1.setAngle(180)
        pause(200)
        crickit.servo1.setAngle(0)
    } else if (num == 0) {
        light.clear()
        crickit.servo1.setAngle(0)
    }
})
let num = 0

CPX Sending Signal

JavaScript
This is the code that allows the CPX's to send signals to each other.
let num = 0
input.pinA3.onEvent(ButtonEvent.Click, function () {
    num = 2
    network.infraredSendNumber(num)
    light.showRing(
        blue blue blue blue blue blue blue blue blue blue
    )
})
input.buttonsAB.onEvent(ButtonEvent.Click, function () {
    light.clear()
})
input.touchA1.onEvent(ButtonEvent.Click, function () {
    num = 0
    network.infraredSendNumber(num)
    light.showRing(
        black black black black black black black black black black
    )
})
input.pinA2.onEvent(ButtonEvent.Click, function () {
    num = 1
    network.infraredSendNumber(num)
    light.showRing(
        "red red red red red red red red red red"
    )
})
input.pinA4.onEvent(ButtonEvent.Click, function () {
    num = 3
    network.infraredSendNumber(num)
    light.showRing(
        white white white white white white white white white white
    )
})
forever(function () {

})

Credits

Santiago Vega
4 projects • 0 followers
Contact
Thanks to Samory Forster, Kevin Parker, and Alyssa Lora.

Comments

Please log in or sign up to comment.