Skip to content

HCSR04-ultrasonic-sensor is lib for use HCSR04 ultrasonic module sensor

License

Notifications You must be signed in to change notification settings

orbitrod/HCSR04-ultrasonic-sensor-lib

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

= HCSR04 ultrasonic sensor Library for Arduino =

HCSR04 is an Arduino library HCSR04 Sensors

HC-SR04

Documentation

Documentation for the library is on the Github Project Pages

basic example

schéma HC_SR04_cabling

#include <HCSR04.h>

HCSR04 hc(2,3);//initialisation class HCSR04 (trig pin , echo pin)

void setup()
{ Serial.begin(9600); }

void loop() 
{ Serial.println( hc.dist() ); } //return current distance (cm) in serial

if you want use a multiple sensor
schéma HC_SR04_multi_cabling

#include <HCSR04.h>

HCSR04 hc(2,new int[6]{5,6,7,8,9,10},6);//initialisation class HCSR04 (trig pin , echo pins, number of sensors)

void setup()
{ Serial.begin(9600); }

void loop()
{ for (int i = 0; i < 6; i++ ) {Serial.println( hc.dist(i) );} }//return curent distance (cm) in serial for sensor 1 to 6

Download

The last version of the Library is available on the github HCSR04 Page

Install

The library can be installed using the standard Arduino library install procedure

MIT License

About

HCSR04-ultrasonic-sensor is lib for use HCSR04 ultrasonic module sensor

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 100.0%