コード例 #1
0
ファイル: line_follow.py プロジェクト: DXM123/GoPiGo
def get_sensorval():
	while True: 
		val=line_sensor.read_sensor()
		if val[0]!=-1:
			return val
		else:
			#Read once more to clear buffer and remove junk values
			val=line_sensor.read_sensor()
コード例 #2
0
ファイル: easygopigo.py プロジェクト: filon2008/GoPiGo
 def read_raw_sensors(self):
     '''
     Returns raw values from all sensors
     From 0 to 1023
     May return a list of -1 when there's a read error
     '''
     five_vals = line_sensor.read_sensor()
     if five_vals != -1:
         return five_vals
     else:
         return [-1, -1, -1, -1, -1]
コード例 #3
0
ファイル: GoPiGoScratch.py プロジェクト: dhegberg/GoPiGo
				ir = ir_read_signal()
			except:
				if en_debug:
					e = sys.exc_info()[1]
					print "Error reading IR sensor: " + str(e)
			if en_debug:
				print "IR Reading: " + str(ir)
			if en_gpg:
				s.sensorupdate({'ir':ir})
				
		# Get the value from the Dexter Industries line sensor
		elif msg=="LINE":
			if en_line_sensor:
				print "LINE!"
				try:
					line=line_sensor.read_sensor()
				except:
					if en_debug:
						e = sys.exc_info()[1]
						print "Error reading Line sensor: " + str(e)
				if en_debug:
					print "Line Sensor Readings: " + str(line)
				if en_gpg:
					s.sensorupdate({'line':line})
		else:
			if en_debug:
				print "m",msg
				print "Wrong Command"
				
		
    except KeyboardInterrupt:
コード例 #4
0
ファイル: test.py プロジェクト: JamesVenezia/GoPiGo
def get_sensorval():
	while True:
		val=line_sensor.read_sensor()
		if val[0]<>-1:
			return val
コード例 #5
0
def get_sensorval():
    while True:
        val = line_sensor.read_sensor()
        if val[0] <> -1:
            return val
コード例 #6
0
ファイル: line.py プロジェクト: 5glab/Client
 def read(self):
     val = line_sensor.read_sensor()
     while val[0] == -1:
         val = line_sensor.read_sensor()
     return val