stamp.peripheral.sensor.range
Class SRF04
java.lang.Object
|
+--stamp.peripheral.sensor.range.SRF04
- public final class SRF04
- extends Object
This class provides an interface to the Devantech SRF04 ultrasonic
range finder module.
Usage:
SRF04 range = new SRF04(CPU.pin0, CPU.pin1); // trigger on P0; ehco on P1
Detailed documentation for the SRF04 can be found at:
http://www.robot-electronics.co.uk
The SRF04 can be purchased from Acroname at:
http://www.acroname.com/robotics/parts/R93-SRF04.html
Constructor Summary |
SRF04(int triggerPin,
int echoPin)
Creates SRF04 range finder object |
SRF04
public SRF04(int triggerPin,
int echoPin)
- Creates SRF04 range finder object
- Parameters:
triggerPin
- SRF04 trigger input (from Javelin)echoPin
- SFR04 echo output (to Javelin)
getRaw
public int getRaw()
- Returns raw distance value from SRF04. Sensor is sampled five times and
the average is returned if in range, otherwise zero is returned to
indicate out-of-range reading.
- Returns:
- Raw distance value from SRF04
getIn
public int getIn()
- Returns:
- SRF04 distance value in inches
getIn10
public int getIn10()
- Returns:
- SRF04 distance value in tenths of inches
getCm
public int getCm()
- Returns:
- SRF04 distance value in centimeters
getMm
public int getMm()
- Returns:
- SRF04 distance value in millimeters