Giter Site home page Giter Site logo

hc-sr04-raspberry-pi-c-'s Introduction

HC-SR04 Raspberry Pi C++

This class allows you to get datas from the HC-SR04 sensor easily in C++!

  • Download WiringPi library

      git clone git://git.drogon.net/wiringPi
      cd wiringPi
      git pull origin
      cd wiringPi
      ./build
    
  • Use the Sonar class as follows:

      Sonar sonar;
      int distance = sonar.distance(30000); // 30000 is a timeout in microseconds
    

Sample: https://github.com/omaflak/HC-SR04-Raspberry-Pi-C-/blob/master/libSonarSample.cpp

hc-sr04-raspberry-pi-c-'s People

Contributors

omaraflak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

hc-sr04-raspberry-pi-c-'s Issues

Which GPIO pins to connect to Raspberry Pi?

I am having a issue in determining which pins to connect the HC-SR04 to my Pi. Is there a parameter option to define the pins?

I have the sensor confirmed working with a python script on GPIO 18 & 24 and this is not a I2C device.

Thanks!

What is the licensing for this code?

Hi,

As the code's author and copyright holder, what rights do you grant for the code in terms of use? I can't seem to find a LICENSE.md file.

Regards,

Rowan

Paramater timeout now used in libSonar.cpp

Hi,
I was taking a look at the libSonar.cpp and realised the parameter "timeout" was not used in double Sonar::distance(int timeout). I believe it is meant to be used in this line of code while (digitalRead(echo) == LOW && micros()-now<30000);.

Too high cpu usage

This is working well on my RaspberryPi but I get a high cpu usage just for measuring a distance.
¿Do you know how to avoid it?

I'm trying to develop something with wiringPiISR but I'm having problems when I want to connect more than one sensor at the same time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.