Need PBASIC Balance Code Quick

By the end of today I need some PBASIC code that will at least attempt to balance this vehicle I am working on. The Demo code for the tilt sensor is here I am only using the Y axis.

My motor speed controls are on pins 12 and 13. I need the speed of the motors to increase proportionally as the angle of tilt increases. The motor controller needs to get a PULSOUT signal. 950 full speed one direction, around 750 is neutral, and about 550 is full speed the other direction. It needs to pause for 20ms between pulses. The tilt angle will be no more than about 6 degrees in each direction. If we can use the straight gyro output instead of converting it to degrees the BASIC stamp will run better because it gets a little bogged down with that.

It is a BS2 I am using.

If you have any more questions I’ll be able to answer them at about 3:30 PM pacific time today. I need to have this code hopefully by 8:00 PM pacific time today.

If someone can help me out ina pinch it would be most certainly appreciated.

This may be of some help:

This was before my time, but it’s the code used on our 2001 robot for balancing on the ramp. I realize that this is a different sensor, but I’m assuming the same general idea is there. Good luck!