Log in

View Full Version : Programming ultrasonic sensor in MPlab


AdamHeard
09-05-2006, 00:07
Hi,
I'm trying to program a vex controller with MPlab and I can't seem to figure out how to program the utlrasonic sensor.

I understand the concept that (speed of sound x return time)/2 = distance but how do I implement it.


I know C syntax and have programmed FRC before, and vex a little. It's just that when I program for my team, most of the time it's control related, or I'm just changing the values of an existing function so I'm not exactly sure how to make this work.

Any Help would be apreciated.

(For reference I have the sensor plugged into Digital 11 and Interupt 1)

MattD
09-05-2006, 00:40
Hi,
I'm trying to program a vex controller with MPlab and I can't seem to figure out how to program the utlrasonic sensor.

I understand the concept that (speed of sound x return time)/2 = distance but how do I implement it.


I know C syntax and have programmed FRC before, and vex a little. It's just that when I program for my team, most of the time it's control related, or I'm just changing the values of an existing function so I'm not exactly sure how to make this work.

Any Help would be apreciated.

(For reference I have the sensor plugged into Digital 11 and Interupt 1)


Team 358 has a Vex Ultrasonic demo code (http://team358.org/files/programming/Vex_Ultrasonic_demo.zip) download on their website. This looks like a good place to start.