Ejemplo n.º 1
0
	def white_line_set_button_OnButtonClick(self,event):
		for i in range(2):
			line_sensor.get_sensorval()
		line_sensor.set_white_line()
		line_val=line_sensor.get_white_line()
		self.label.SetLabel("White Line : "+str(line_val))
Ejemplo n.º 2
0
 def white_line_set_button_OnButtonClick(self, event):
     for i in range(2):
         line_sensor.get_sensorval()
     line_sensor.set_white_line()
     line_val = line_sensor.get_white_line()
     self.label.SetLabel("White Line : " + str(line_val))
Ejemplo n.º 3
0
				try:
					l.set_black_line()
				except:
					if en_debug:
						e = sys.exc_info()[1]
						print "Error reading Line sensor: " + str(l.black_line)
				if en_debug:
					print "Black Line Sensor Readings: " + str(l.black_line)
				if en_gpg:
					s.sensorupdate({'black_line':l.black_line})
		
		elif msg.lower()=="SET_WHITE_LINE".lower():
			if en_line_sensor:
				print "SET_WHITE_LINE!"
				try:
					l.set_white_line()
				except:
					if en_debug:
						e = sys.exc_info()[1]
						print "Error reading Line sensor: " + str(l.white_line)
				if en_debug:
					print "White Line Sensor Readings: " + str(l.white_line)
				if en_gpg:
					s.sensorupdate({'white_line':l.white_line})		
		
		elif msg.lower()=="READ_IR".lower():
			print "READ_IR!" 
			if en_ir_sensor==0:
				import lirc
				sockid = lirc.init("keyes", blocking = False)
				en_ir_sensor=1
Ejemplo n.º 4
0
				try:
					l.set_black_line()
				except:
					if en_debug:
						e = sys.exc_info()[1]
						print "Error reading Line sensor: " + str(l.black_line)
				if en_debug:
					print "Black Line Sensor Readings: " + str(l.black_line)
				if en_gpg:
					s.sensorupdate({'black_line':l.black_line})
		
		elif msg=="SET_WHITE_LINE":
			if en_line_sensor:
				print "SET_WHITE_LINE!"
				try:
					l.set_white_line()
				except:
					if en_debug:
						e = sys.exc_info()[1]
						print "Error reading Line sensor: " + str(l.white_line)
				if en_debug:
					print "White Line Sensor Readings: " + str(l.white_line)
				if en_gpg:
					s.sensorupdate({'white_line':l.white_line})		
		
		elif msg=="READ_IR":
			print "READ_IR!" 
			if en_ir_sensor==0:
				import lirc
				sockid = lirc.init("keyes", blocking = False)
				en_ir_sensor=1
Ejemplo n.º 5
0
        val = line_sensor.read_sensor()
        if val[0] <> -1:
            return val


print "WHITE LINE SETUP!!"
while True:
    print "Keep all the sensors over a white strip and press [Enter]"
    raw_input()
    print "--> Line sensor value: ",
    get_sensorval()
    print get_sensorval()
    print "If the reading look good, press 'y' and [Enter] to continue"
    inp = raw_input()
    if inp == 'y':
        line_sensor.set_white_line()
        break
print "White Line Values set: ",
print line_sensor.get_white_line()

print "BLACK LINE SETUP!!"
while True:
    print "Keep all the sensors over a black strip and press [Enter]",
    raw_input()
    print "--> Line sensor value: ",
    get_sensorval()
    print get_sensorval()
    print "If the reading look good, press 'y' and [Enter] to continue"
    inp = raw_input()
    if inp == 'y':
        line_sensor.set_black_line()
Ejemplo n.º 6
0
			return val
		#else:
			#Read once more to clear buffer and remove junk values
		#	val=line_sensor.read_sensor()
	
print "WHITE LINE SETUP"
while True:	
	print "\nKeep all the sensors over a white strip and press ENTER",
	raw_input()
	print "--> Line sensor readings: ",
	get_sensorval()
	print get_sensorval()
	print "If the reading look good, press 'y' and Enter to continue, any other key to read again" 
	inp=raw_input()
	if inp=='y':
		line_sensor.set_white_line()
		break
print "White Line values set:",
print line_sensor.get_white_line()

print "BLACK LINE SETUP"
while True:	
	print "\nKeep all the sensors over a black strip and press ENTER",
	raw_input()
	print "--> Line sensor readings: ",
	get_sensorval()
	print get_sensorval()
	print "If the reading look good, press 'y' and Enter to continue, any other key to read again" 
	inp=raw_input()
	if inp=='y':
		line_sensor.set_black_line()