led.off() buz.off() print("BeBe call with LED") elif data == c_dict['g']: print("light value: ", light.value) elif data == c_dict['h']: for i in range(0, 10): if i <10 and light.value <= 0.96: led.on() buz.on() sleep(0.1) led.off() buz.off() sleep(0.1) else: led.off() buz.off() print("value <= 0.96: LED and Buzzer On") else: print('Unknown Command: {}'.format(data)) except KeyboardInterrupt: print("Close!!") finally: if 'client_socket' in vars(): client_socket.close() server_socket.close() led.close() buz.close() print("Stop Connection")
#GPIO.setmode(GPIO.BOARD) buzzer = Buzzer(17) try: text = raw_input("Please enter Data Name : ") print("Now place your tag to write") reader.write(text) print("Data recorded") GPIO.setup(18, GPIO.OUT) GPIO.output(18, GPIO.HIGH) time.sleep(0.2) GPIO.output(18, GPIO.LOW) time.sleep(0.2) GPIO.output(18, GPIO.HIGH) time.sleep(0.2) GPIO.output(18, GPIO.LOW) time.sleep(0.2) GPIO.output(17, GPIO.HIGH) time.sleep(0.5) GPIO.output(17, GPIO.LOW) time.sleep(0.5) #buzzer.on() #sleep(0.5) #buzzer.off() #sleep(0.5) finally: #GPIO.cleanup() buzzer.close()