31. ejectIRのソースはこんな感じ
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(1)
os.system("eject -t")
continue
else:
print "no input"
GPIO.cleanup()
51. A module to control Raspberry Pi GPIO channels
This package provides a class to control the GPIO on a Raspberry Pi.
https://pypi.python.org/pypi/RPi.GPIO より引用
GPIO: General Purpose Input/Output(汎用入出力)