Hi, I was recently using python with csound on the raspberry pi to read some control values off the digital inputs. I was using some nested if statements to make it so that a button would toggle the control value between 0 and 1. It wasn't working in my csd despite everything else compiling and running fine, so I isolated it in python. The only part that doesn't is the nest if statements that are supposed to make it toggle between the two values, it always prints 0.0 instead of switch between 1.0 and 0.0. I've included my code, Does anyone see anything wrong?

import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.IN, pull_up_down = GPIO.PUD_DOWN)
GPIO.setup(24, GPIO.IN, pull_up_down = GPIO.PUD_UP)
a = 0.0
b = 0.0
c = 0

while True:
if(GPIO.input(4) ==1 and c ==0):
print 'Button 1 Pressed'
if(a ==0.0):
a = 1.0
if(a == 1.0):
a = 0.0
c = 1
print a
if(GPIO.input(4) !=1):
c = 0
if(GPIO.input(24) ==0):
print 'Button 2 Pressed'
Csound mailing list [log in to unmask] https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here