ericksimoes / ultrasonic Goto Github PK
View Code? Open in Web Editor NEWMinimalist library for Ultrasonic Module HC-SR04, PING))) and Seeed SEN136B5B to Arduino
License: MIT License
Minimalist library for Ultrasonic Module HC-SR04, PING))) and Seeed SEN136B5B to Arduino
License: MIT License
Classes are useful, but their performance is less than using structs (given due proportions).
Therefore, it may be interesting to adopt the use of structs where classes are used today. Considering that one of the objectives of this library is to be minimal and optimized, consuming as few resources as possible.
I used your library today in VS Code, I verified the code on Arduino UNO board,
the IDE said: 'class Ultrasonic' has no member named 'read'
by the intellisense function, I knew it was "distanceRead()" rather than "read()", so maybe there need an update in your example code in PlatformIO extension for VS Code.
The issue #30 requires that wiring image be updated with a Seed Studio sensor.
A 30 millisecond delay after trigger is a huge time (Ultrasonic.cpp@48).
Maybe was 30 microseconds?
In C / C ++ object names do not necessarily accurately begin with capital letter.
Timeouts
are a new feature and need some examples.
int
type is unnecessarily large.
The issue #30 requires new examples files using Seed Studio Ultrasonic Sensor.
There are many old commits with title and description in Portuguese.
In order to internationalize this project, it is important to translate into English.
The Ultrasonic module of Seeed Studio is diferent of HC-SR04.
It has only one reading and writing pin.
See documentation: http://wiki.seeed.cc/Ultra_Sonic_range_measurement_module/
Old IDEs of Arduino haven't support to Arduino.h
library.
To keep the most hight compatibility, is important to use the #include <WProgram.h>
code block.
In the files Ultrasonick.h
and Ultrasonick.cpp
are incluided Arduino.h
.
It is written "Import library", the correct is "Include Library", on README file.
There are minor fixes to be made to this file:
distanceRead()
method it will be possible to obtain the distance in inches;12
and 13
;The comments are very long, in some cases taking up 10 lines.
To improve readability, I recommend putting only references to the latest update. The history of who created or contributed is already registered on GitHub itself.
The excerpt present at the beginning of the archives .h
e .cpp
:
#if (ARDUINO >= 100)
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
can be removed.
hi there
Thank you very much for the library.
I have created a simulation page for the Ultrasonic sensor library here:.
https://wokwi.com/arduino/projects/296099969420493322
It is a permanent page and it gives an opportunity for your future library users to play with the library and get a feel of it even before they integrate the library into their own project.
Kindly let me know what you think!
If you feel it is good, I would love to create a PR to add the simulation link in the ReadMe file.
Thanks a lot!
Puneeth
Apparently, when this library is used on a non-Arduino-based device, the pulseIn()
method, used to wait the echo, causes incompatibility problems.
To prevent any future problems, is recommended to use another strategy to read the length of the pulse (in microseconds), like using micros()
.
The latest Arduino library specification recommends that there be a library.properties
file at the root of the project.
This file should follow the pattern specified here.
"Library for HC-SR04 Ultrasonic Ranging Module in a minimalist way"
Now is possible install the library via IDE.
This should be documented in the README.md
The issue #30 requires that the documentation be updated.
The underscore has been placed to signal which variables are private, but this is not elegant.
Using the static
keyword can solve this visibility issue.
Translate README file to Brazilian portuguese
Description
The README.md file is available in English only. To expand the reach of this lib, it is important that it be available in other languages.
Add references to a new modules suported.
This references is from #61
Update number version and create a new tag.
Hi! I'm using an older version of Madsonic server, latest free, without activation (MADSONIC 5.1.5260.20150831.0820) and after your latest update your android client can't connect to server. (A network error ocurred. Please check the server address or try again.)
Thank you for all your work!
Why is the time of the answer on the echo-Pin used for distance calculations?? The resulting values are fluctuating strongly.
They are also far worse than calculations based on the runtime of the plus?
This design decision seems to be a "wrong" choice. I noticed this while using the library and couldn't isolate the fluctuating measurements I got while using the sensor because it came from this library with over 1500 uses on Platform IO.
I am somewhat puzzled that the way the time is measured can at all be used for distance calculations!!
Warning: In member function 'int Ultrasonick::distanceRead()
'
\Ultrasonick\src\Ultrasonick.cpp:52:1
Currently the constants referring to sound speed can not be modified by the API, just by modifying the code manually.
Consider allowing the value to be passed as a parameter, as a setting.
Translate README file to Spanish.
Description
The README.md file is available in English only. To expand the reach of this lib, it is important that it be available in other languages.
The layout of folders and files should follow the new specification of libraries:
See Arduino documentation
In the README file there is a topic about the license that is unattended.
The license is poorly defined.
It is necessary to choose a permissive license, which projects the copyright and stimulates the external contribution.
Describe the bug
Code loads, Serial monitor prints line statements but measurement value is always 0
Code to reproduce
#include <Ultrasonic.h>
Ultrasonic myUltrasonicSensor(5);
int distance;
void setup() {
Serial.begin(9600);
}
void loop() {
// Pass INC as a parameter to get the distance in inches
distance = myUltrasonicSensor.read();
Serial.print("Distance in CM: ");
Serial.println(distance);
delay(1000);
}
Wiring
Connected to a Seead Senor Shield
Expected behavior
As Sensor is moved distance value should show distance to object
Error message
none
Context (please complete the following information):
It is necessary to investigate cases where the returned value can be negative.
In such cases you must ensure that only values equal to or greater than zero can be returned.
It is currently outdated.
The name distanceRead()
is too long.
To be more friendly, and less verbal, it may can be something like read()
The method can be simplified if the constants CM and INC represent the divisors, like this:
unsigned int Ultrasonic::distanceRead(uint8_t divisor) {
return timing() / divisor / 2;
}
Explain that it is possible to use 3 pin sensors.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.