I'm currently using an mq5 gas sensor in my kitchen with the MCP3208 ADC. my code shows a continuous loop of the voltage charge. in the mq5 as it detects gases in the air. It is supposed to print ("Gas leak") on line 9 when the voltage reaches the set threshold of 0.50 but it does not. Am i doing something wrong?
#main loop def main(): init() while True: smokelevel=readadc(smokesensor_apin, SPICLK, SPIMOSI, SPIMISO, SPICS) if GPIO.input(smokesensor_dpin)> 0.50 : if GPIO.input(smokesensor_dpin) > 0.50 : print("Gas leak") else: print("Gas lealage") print"Current Gas AD vaule = " +str("%.2f"%((smokelevel/1024.)*5))+" V" time.sleep(0.5) if __name__ =='__main__': try: main() pass except KeyboardInterrupt: pass