I'm a newbie!
I have python files code to turn on the light:
i tried here
and here and here here on forum
i chmod pi for /dev , adduser group
file 1
print "================================"
print "ROBOT: DANG MO QUAT"
print "================================"
os.system("aplay -D hw:1,0 /home/pi/jasper/static/audio/dangmoquat.wav")
minh.main(['-p',pin,'on'])
file 2 access GPIO:
def GPIO_SETMODE(pin):
if int(pin) in GPIOs:
# GPIO.cleanup()
GPIO.setmode(GPIO.BOARD) ## Use BOARD pin numbering
GPIO.setup(int(pin), GPIO.OUT)
return True
else:
return False
def main(argv):
type = ''
try:
opts, args = getopt.getopt(argv,"b:p:h:s:r",['input=', 'params=', 'help'])
except getopt.GetoptError:
print 'Wrong command'
sys.exit(2)
print opts,args
for opt, arg in opts:
#...........doing something here....................#
elif opt in ("-p", "--power"):
input = arg
if GPIO_SETMODE(input):#------------> errror occurs here#
if args[0] == 'on':
Power(int(input), True)
elif args[0] == 'off':
Power(int(input), False)
else:
print 'Please choose on or off'
Error occurs here.
"No access to /dev/mem. Try running as root!" i have try here
and here and here here on forum
and google. I was awaked until dawn. I have chmod 777 pi dev -R What can i do know? Please help me.