import sys GPIO="/sys/class/gpio/gpio11" def write(): fo = open(GPIO + "/direction", "w") fo.write("out") fo = open(GPIO + "/value", "w") fo.write("1") fo = open(GPIO + "/value", "r") read = fo.read() print(read)