David Linaburg
Created September 22, 2020

Pop of Light

Project 1 for DIG3602

BeginnerWork in progress7
Pop of Light

Story

Read more

Code

Untitled file

JavaScript
pins.A1.setPull(PinPullMode.PullUp)
pins.A4.setPull(PinPullMode.PullUp)
pins.A7.setPull(PinPullMode.PullUp)
forever(function () {
    if (pins.A4.digitalRead()) {
        light.setAll(0x007fff)
    } else {
        light.clear()
    }
})
forever(function () {
    if (pins.A1.digitalRead()) {
        light.setAll(0xff0000)
    } else {
        light.clear()
    }
})
forever(function () {
    if (pins.A7.digitalRead()) {
        light.setAll(0xffff00)
    } else {
        light.clear()
    }
})
forever(function () {
    if (pins.A1.digitalRead()) {
        if (pins.A4.digitalRead()) {
            light.setAll(0x7f00ff)
        } else {
            light.clear()
        }
    } else {
        light.clear()
    }
})
forever(function () {
    if (pins.A1.digitalRead()) {
        if (pins.A7.digitalRead()) {
            light.setAll(0xff8000)
        } else {
            light.clear()
        }
    } else {
        light.clear()
    }
})
forever(function () {
    if (pins.A4.digitalRead()) {
        if (pins.A7.digitalRead()) {
            light.setAll(0x00ff00)
        } else {
            light.clear()
        }
    } else {
        light.clear()
    }
})
forever(function () {
    if (pins.A1.digitalRead()) {
        if (pins.A4.digitalRead()) {
            if (pins.A7.digitalRead()) {
                light.setAll(0xffffff)
            } else {
                light.clear()
            }
        } else {
            light.clear()
        }
    } else {
        light.clear()
    }
})

Credits

David Linaburg
4 projects • 0 followers
Contact

Comments

Please log in or sign up to comment.