def main():
	R = Robot()
	
	R.compass.startCalibration()
	R.turn(8)
	time.sleep(20)
	R.compass.stopCalibration()
	R.stop()
	while True:
		print "bearing " + str(R.compass.heading)
		time.sleep(0.1)
Example #2
0
def main():
	R = Robot()
	t = CompassThread(R)
	t.start()
	
	
	t.target = 0
	time.sleep(2.5)
	
	t.speed = 25
	time.sleep(1)
	t.speed = 0
	
	t.target = 90
	time.sleep(2.5)
	
	t.speed = 25
	time.sleep(1)
	t.speed = 0
	
	t.target = 180
	time.sleep(2.5)
	
	t.speed = 25
	time.sleep(1)
	t.speed = 0
	
	t.target = 270
	time.sleep(2.5)
	
	t.speed = 25
	time.sleep(1)
	t.speed = 0
	
	t.target = 0
	t.running = False
	t.join()
	R.stop()