Skip to content

Instantly share code, notes, and snippets.

@Na0ki
Created July 1, 2014 01:18
Show Gist options
  • Save Na0ki/59ca80937dcd3107db57 to your computer and use it in GitHub Desktop.
Save Na0ki/59ca80937dcd3107db57 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
#coding: utf-8
import RPi.GPIO as GPIO
import os
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.IN)
while 1:
if GPIO.input(4):
os.system("eject")
print "Welcome to my room!!"
time.sleep(5)
os.system("eject -t")
continue
else:
print "no input"
GPIO.cleanup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment