View Single Post
  #1   Spotlight this post!  
Unread 22-11-2014, 17:22
yash101 yash101 is offline
Curiosity | I have too much of it!
AKA: null
no team
 
Join Date: Oct 2012
Rookie Year: 2012
Location: devnull
Posts: 1,191
yash101 is an unknown quantity at this point
Parallax PING))) Java Coding

Our team bought the Ping))) sensor for distance sensing. As per this forum post, we could use a PWM Y-cable to connect it to the digital sidecar. How do we code this in Java? I believe that the WPILib Ultrasonic class is meant for those sensors with an input and output.

The Ping))) has a built-in SX microcontroller with the job of generating the pulse and patiently waiting for that pulse to make it's way back. It then sends back a pulse, with a width that translates into the distance, by the multiplication of a specific constant, 2260 for centimeters and 890 for inches.

Note that the time units are in microseconds.

How do I send 30 microsecond pulse to a digital output and read back the input pulse, probably from a different pin if I use the Y-cable method?