Lylly Hoang
Created February 18, 2020

You Can't Choose

Object of protest for LGBTQ rights!

12
You Can't Choose

Story

Read more

Custom parts and enclosures

Video Demo

Schematics

Stage of Development

Stage of Development

Stage of Development

Final Product

Code

You Can't Choose

Python
I used circuitpython for this project in order to upload an audio file. This book is an object of protest. When opened, the individual will hear the chant "you can't choose" until the book is closed. It's used to represent how an individual can not choose their sexuality. The outside of the book reads, "Only Open if Gay" and the inside reads, "Gay or straight, you choose to open this book. You can't choose your sexuality". The saying outside the book doesn't matter much, it's just supposed to represent the fact that whoever is holding the book is probably going to be curious enough to choose and open the book regardless of if he or she is gay or not. And unlike having the choice to open the book regardless of sexuality; sexuality itself isn't a choice.

The circuit board express has a light sensor. When it's inside the closed book, there is no light so nothing happens. When the book is opened, there should ideally be light in the environment. When the sensor detects light, the audio file plays on loop 3 times and the neopixel lights circulate in rainbow colors until the book is closed (can't detect light anymore).
from adafruit_circuitplayground import cp
import time

def pixelmixer(rgb, i):
    i = (mixer + i) % 10
    cp.pixels[i] = rgb
    
def rainbow(mixer):    
    pixelmixer((255, 0, 0), 0)
    pixelmixer((255, 165, 0), 1)
    pixelmixer((255, 255, 0), 2)
    pixelmixer((0, 128, 0), 3)
    pixelmixer((0, 0, 255), 4)
    pixelmixer((75, 0, 130), 5)
    pixelmixer((238, 130, 238), 6)

cp.pixels.brightness = .1
cp.pixels.fill((0, 0, 0))
cp.pixels.show()

mixer = 0
repeatcount = 0

while True: 
    print(cp.light)
    if cp.light > 5:
        if repeatcount < 3:
            rainbow(mixer)
            cp.play_file("choose.wav")
            repeatcount += 1
        else:
            cp.pixels.fill((0, 0, 0))
            repeatcount = 0
    else:
        cp.pixels.fill((0, 0, 0))
        
    cp.pixels.show()
    
    mixer += 1

Credits

Lylly Hoang
4 projects • 0 followers

Comments