SRF05 Ultrasonic Ranger

Table of Contents

  1. Hello World!
  2. Library
  3. Other

An ultrasonic rangefinder

/media/uploads/simon/srf05.jpg

Hello World!

Import program

00001 // Simple program to read the distance from an SRF05 using the SRF05 library
00002 
00003 #include "mbed.h"
00004 #include "SRF05.h"
00005 
00006 SRF05 srf(p13, p14);
00007  
00008 int main() { 
00009      while(1) { 
00010          printf("Distance = %.1f\n", srf.read());              
00011          wait(0.2); 
00012      } 
00013  } 
SRF05 pinSignalmbed pin
1+5v SupplyVu
2Echo outputp14
3Trigger inputp13
4Moden/c
50v GroundGND

/media/uploads/simon/srf05_breadboard.jpg

Library

Import library

Public Member Functions

SRF05 (PinName trigger, PinName echo)
Create a SRF05 object, connected to the specified pins.
float read ()
A non-blocking function that will return the last measurement.
operator float ()
A short hand way of using the read function.

Other


All wikipages