Add code to internet radio program? - Raspberry Pi Forums


hello everyone, happy new year! making internet radio project based 2 related tutorials , works nice after few first tests did today. appears both tutorials did not include volume control via buttons on gpio. found code think add python program, don't know how program in. not sure how add code program.

internet radio program using http://usualpanic.com/2013/05/raspberry ... net-radio/

code add internet radio program... best way this?

code: select all

if (volup==true): if(gpio.input(17) == false): lcd_byte(lcd_line_2, lcd_cmd) lcd_string("lauter") #print "lauter" os.system("sudo mpc -q volume +1") #sleep(.1) volup = gpio.input(17)   if (voldown==true): if(gpio.input(22) == false): #print "leiser"  lcd_byte(lcd_line_2, lcd_cmd) lcd_string("leiser") os.system("sudo mpc -q volume -1") #sleep(.1)  voldown = gpio.input(22)
appreciated :)

what if you put

code: select all

if(gpio.input(17) == false:    os.system("sudo mpc -q volume +1")    sleep(1) if(gpio.input(22) == false:    os.system("sudo mpc -q volume -1")    sleep(1) 
starting @ line 99

, @ line 36 add import os

, @ line 55 add

gpio.setup(17, gpio.in, pull_up_down=gpio.pud_up)
gpio.setup(22, gpio.in,pull_up_down=gpio.pud_up)

note these gpio bcm numbers, , physical pins 11 , 15.


raspberrypi



Comments

Popular posts from this blog

invalid use of void expresion in FlexiTimer2 library

error: a function-definition is not allowed here before '{' token

LED Strip Code