Python: Ultrasonic Sensor Info alone

I have this code:

# Yannick Gloster
# December 12, 2013
# Made for the La Colina Science Fair 2013
#
# This code is a code to go through a simple maze

import BrickPi

BrickPiSetup()

BrickPi.MotorEnable[PORT_A] = 1 
BrickPi.MotorEnable[PORT_B] = 1 
BrickPi.MotorEnable[PORT_C] = 1 
BrickPi.SensorType[PORT_1] = TYPE_SENSOR_ULTRASONIC_CONT 

BrickPiSetupSensors()
while True
	result = BrickPiUpdateValues()
	print "Moving Foward"
	BrickPi.MotorSpeed[PORT_B] = 100	
	BrickPi.MotorSpeed[PORT_C] = 100
	BrickPiUpdateValues()
	if result < 21 :
		print "Turning"
		BrickPi.MotorSpeed[PORT_B] = 0
		BrickPi.MotorSpeed[PORT_C] = 0 
		BrickPi.MotorSpeed[PORT_A] = 50	
		BrickPi.MotorSpeed[PORT_B] = 200
		BrickPi.MotorSpeed[PORT_C] = -200
		time.sleep(1)
		BrickPi.MotorSpeed[PORT_A] = 0
		BrickPiUpdateValues()

And I can’t figure out how to get the BrickPiUdateValues just for the Ultrasonic Sensor

Ostrich, if you’re using the ultrasonic sensor, is it possible to try running that example code? I’m not sure if I understand what’s not working with the code or the BrickPi here.

Nm, After getting help at my local makerspace, We got it worked out!

It was just a coding error.
I think you guys should create documentation on coding of just the brickpi because it can be confusing
.

# Yannick Gloster
# December 15, 2013
# Made for the La Colina Science Fair 2013
#
# This code is a code to go through a simple maze

import BrickPi

BrickPiSetup()

BrickPi.MotorEnable[PORT_A] = 1 
BrickPi.MotorEnable[PORT_B] = 1 
BrickPi.MotorEnable[PORT_C] = 1 
BrickPi.SensorType[PORT_1] = TYPE_SENSOR_ULTRASONIC_CONT 

BrickPiSetupSensors()
while True
	print "Moving Foward"
	BrickPi.MotorSpeed[PORT_B] = 100	
	BrickPi.MotorSpeed[PORT_C] = 100
	BrickPiUpdateValues()
	if BrickPi.Sensor[PORT_1] < 21 :
		print "Turning"
		BrickPi.MotorSpeed[PORT_B] = 200
		BrickPi.MotorSpeed[PORT_C] = 200 
		BrickPi.MotorSpeed[PORT_A] = 50	

Hey Ostrich, glad we got this figured out. sorry if the coding was confusing.

Can you elaborate a little? We can definitely take a shot at making it easier if you give us an idea. We thought that well commented examples would be a good start, but we’re happy to put more out there if you give us an idea.

Well when I’m programing my BrickPi, It would be nice to have like a pdf file that could be printed out saying that
BrickPi.MotorSpeed[Port_A] = Variable
Sets the speed of motor on port A.

The comments were really useful but a coding manual would be even better.

It would be something like a dummy’s guide to the brickpi (except not under that name because of copyright!)