# # Example program for d5000_serial module # Eli Fulkerson # import d5000_serial from time import clock def do_x_times(module, numtimes): print "Now, sending the RD command " + str(numtimes) + " times..." starttime = clock() for a in range(1,numtimes): tmp = module.sendcmd("RD") endtime = clock() period = endtime - starttime rate = period / numtimes print "Done! We took: " + str(period) + " s, thats " + str(rate) + " s per reading" print def main(): print "Stress Sensor" print "--------------" print "Connect to the thermocouple over and over and display how long the" print "readings take to complete." print "--------------" print print "Starting..." print "Initializing the com port..." # our sensor is plugged into COM1 at 9600 baud... other options are specifiable if needed # 0 is COM1, 1 is COM2, etc etc etc. On unix 0 would be /dev/sd0 (I think), 1 would be /dev/sd1 etc... sensor = d5000_serial.sensor("-p 0 -r 9600") print "...OK" print print "Setting up the individual module..." module = d5000_serial.module(sensor, 1) print "...OK" print print "Sending the command 'RD'..." tmp = module.sendcmd("RD") print "Output from the RD command is: " + tmp print # beat up on the thermocouple a bit to see how long the readings take do_x_times(module,10) do_x_times(module,10) do_x_times(module,10) do_x_times(module,100) do_x_times(module,1000) main()