Skip to content

matheusamazonas/Ultrino

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ultrino

Arduino library for the HC-SR04 ultrasonic sensor. The distance is returned in centimeters.

Linux: : Build Status

Installation

For a simple, easy installation download the repository as a zip file and follow the instructions on how to install an Arduino library from a zip file.

Example

The example below is also in the examples folder. The manifacturer recomends an interval of at least 60 milliseconds between readings.

#include <Ultrino.h>

Ultrino us(2,4);

void setup() {
  Serial.begin(9600);
  while (!Serial) {
  }
  Serial.println("Setup is done");
}

void loop() {
  Serial.print("Distance: ");
  Serial.println(us.getDistance());
  delay(60);	// Recommended by manufacturer
}