8bitsandabyte
Published © GPL3+

The Goodbye Machine: Automate Your Goodbyes

Easily tell people how you feel with a machine!

EasyShowcase (no instructions)Over 1 day507
The Goodbye Machine: Automate Your Goodbyes

Things used in this project

Hardware components

Raspberry Pi 3 Model B
Raspberry Pi 3 Model B
×1
Adafruit Massive Arcade Button RED
×1
Adafruit Massive Arcade Button Green
×1
mg995
×2
Adafruit Mini External USB Stereo Speaker
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Dremel 4300

Story

Read more

Code

Untitled file

Python
import RPi.GPIO as GPIO
import time
import os

# GPIO.setmode(GPIO. BOARD)
GPIO.setmode(GPIO.BCM)
GPIO.setup(3,GPIO.OUT)

pwm = GPIO.PWM(3,60)
pwm.start(0)

GPIO.setup(21, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(20, GPIO.IN, pull_up_down=GPIO.PUD_UP)


def setAngle(angle):

    duty = angle / 18 + 2
    GPIO.output(3,True)
    pwm.ChangeDutyCycle(duty)
    sleep(1)
    GPIO.output(3,False)
    pwm.ChangeDutyCycle(0)


def fuckYou():
    os.system('sudo mplayer -volume 60 /home/pi/Desktop/goodbey-i-nator/FuckYou.wav &')


def playSweetGoodbey():
    os.system('sudo mplayer -volume 60 /home/pi/Desktop/goodbey-i-nator/GoodBye.wav &')

while True:
    input_state_green = GPIO.input(21)
    input_state_red = GPIO.input(20)

    if input_state_green == False:
        playSweetGoodbey()
        time.sleep(0.2)
    elif input_state_red == False:
        fuckYou()
        time.sleep(0.2)

pwm.stop()
GPIO.cleanup()

Credits

8bitsandabyte

8bitsandabyte

2 projects • 0 followers
Hi, we're two makers that create stuff, which we happily share with you!

Comments