Main Site Documentation

PWM Input on Fez Spider


#1

Hi Guys,

I love how easy it is to set up an input using GT.interface, however, is there an easy way to create a PWM input - I was hoping to read a sonic ranger.

Thanks.


#2

How fast is the frequency?


#3

This pin outputs a pulse width representation of range. To calculate distance use the scale factor of 147uS per inch.

pulse = pulseIn(pwPin, HIGH);
//147uS per inch
inches = pulse/147;

This is what I used on the Arduino. Does that help?


#4

The best way is to use PinCapture.


#5

Perfect - thank you. It looks straight forward enough.