Giter VIP home page Giter VIP logo

hc-sr04's Introduction

Hey... I'm Dirk. Developer, Gamer and Dad ๐Ÿ‘‹

Metrics: Languages Metrics: Repositories Metrics: Other

hc-sr04's People

Contributors

d03n3rfr1tz3 avatar

Stargazers

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

Watchers

 avatar

hc-sr04's Issues

Returning dynamic arrays from a function creates a memory leak

In C you should never return a dynamic array from a function. C has no garbage collector. So all those arrays you create, will never be deleted. In the loop function of your demo thousands of arrays are created, but never deleted.
If you need to return an array, use return parameters. This way the user is responsible to allocate and delete memory for the array.

overflow in implicit constant conversion

void begin(byte triggerPin, byte* echoPins, byte echoCount) { begin(triggerPin, echoPins, echoCount, 100000, eUltraSonicUnlock_t::unlockSkip); }

Compiler says:

/somewhere/HC-SR04/src/HCSR04.h: In member function 'void HCSR04Sensor::begin(byte, byte*, byte)':
/somewhere/HC-SR04/src/HCSR04.h:27:143: warning: overflow in implicit constant conversion [-Woverflow]
   void begin(byte triggerPin, byte* echoPins, byte echoCount) { begin(triggerPin, echoPins, echoCount, 100000, eUltraSonicUnlock_t::unlockSkip); }

100000 is greater than INT_MAX for arduino.

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.