def reg_test(): register_device(get_local_ip('eth0'), gen_id_val())
values_dict[n] = 'N/A' return values_dict if __name__ == '__main__': #get the id_val of the device dev_id = gen_id_val() device = connect_phidget() #We can use a timer thread for this.. just wanted to keep it simple for #my own sake. while True: sleep(3) device.setOutputState(0, 0) #getting the IP here, don't really need to do this after some recent updates ip_addy = get_local_ip('eth0') log_info('IP is: %s' % ip_addy) register_device(ip_addy, dev_id) sensor_data = check_sensors(device) log_info(sensor_data) response = put_value_change(dev_id, sensor_data, True) if response == 0: device.setOutputState(0, 1) device.closePhidget() #Only here to block until user keyboard input, which will end the program. #character = str(raw_input()) #we have to close the phidget after we are done.. #device.closePhidget()
#print 'no sensor attached to port %s'%n values_dict[n] = 'N/A' return values_dict if __name__ == '__main__': #get the id_val of the device dev_id = gen_id_val() device = connect_phidget() #We can use a timer thread for this.. just wanted to keep it simple for #my own sake. while True: sleep(3) device.setOutputState(0,0) #getting the IP here, don't really need to do this after some recent updates ip_addy = get_local_ip('eth0') log_info('IP is: %s'%ip_addy) register_device(ip_addy,dev_id) sensor_data = check_sensors(device) log_info(sensor_data) response = put_value_change(dev_id,sensor_data,True) if response == 0: device.setOutputState(0,1) device.closePhidget() #Only here to block until user keyboard input, which will end the program. #character = str(raw_input()) #we have to close the phidget after we are done.. #device.closePhidget()