alsan / arduino-new-ping Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/arduino-new-ping
Automatically exported from code.google.com/p/arduino-new-ping
When using ping_timer(), then check_timer(), it only returns true once a ping
is received, requiring the timeout to be tracked both in the library and
outside the library, requiring extra ram and processing cycles.
Changing the check_timer() method to type int8_t instead of boolean, then in
the "Outside the timeout limit" block return -1, and in the "Ping echo
received" return 1, and default return 0 allows the sketch to piggyback off the
library code, saving ram and extra conditional checks.
new method would look like:
int8_t NewPing::check_timer() {
if (micros() > _max_time) { // Outside the timeout limit.
timer_stop(); // Disable timer interrupt
return -1; // return ping echo timed out.
}
if (!(*_echoInput & _echoBit)) { // Ping echo received.
timer_stop(); // Disable timer interrupt
ping_result = (micros() - (_max_time - _maxEchoTime) - 13); // Calculate ping time, 13uS of overhead.
return 1; // Return ping echo positive.
}
return 0; // Return 0 because there's no ping echo yet.
}
Original issue reported on code.google.com by [email protected]
on 28 Feb 2014 at 4:18
What steps will reproduce the problem?
1. Use adafruit motor shild
2. Use DC motors
3.
What is the expected output? What do you see instead? I expect to be able to
use both simultaneously if I don't use servo motors. Instead I have errors with
timer2 preventing newping or the motorshield pwm from working
What version of the product are you using? On what operating system?
Arduino 1.0.5 Windows 8.1
Please provide any additional information below.
I would like to be able to select which timer to use with the library, in case
I'm using another library which conflicts. I know that in some cases all timers
will be in use, but in others it would be useful to be able to select which
timer to use.
Original issue reported on code.google.com by [email protected]
on 3 Dec 2013 at 8:29
What steps will reproduce the problem?
1. use the function ping_median(5) in the loop() method
2.
3.
What is the expected output? What do you see instead?
Expect reliable and continuous operation without freezing. Instead after a few
seconds the adruino often freezes. I have a delay(50) in my loop.
ping() works very reliably without freezing, but ping median seems to have
issues.
What version of the product are you using? On what operating system?
Downloaded on 02 JUNE 2013
Please provide any additional information below.
NO additional information.
Original issue reported on code.google.com by [email protected]
on 2 Jun 2013 at 9:01
What steps will reproduce the problem?
1. Built circuit using HC-SR04 sensor
2. Aimed it at wall
3. Ran basic new ping program
What is the expected output? What do you see instead?
I expect fairly constant reading of distance. What I see instead is
a lot of variation, like this;
Ping: 87 inches
Ping: 89 inches
Ping: 86 inches
Ping: 85 inches
Ping: 87 inches
Ping: 86 inches
Ping: 85 inches
Ping: 0 inches
Ping: 73 inches
Ping: 84 inches
Ping: 84 inches
Ping: 85 inches
Ping: 85 inches
Ping: 84 inches
What version of the product are you using? On what operating system?
NewPing 1.5, Windows XP computer, ITEADUINO 2.2 platform
Please provide any additional information below.
I may be missing something since this is my first ping project,
but if it can't be much more consistent, then it is of no use
to me.
Original issue reported on code.google.com by [email protected]
on 29 Mar 2013 at 1:37
What steps will reproduce the problem?
1. verify
2. upload
3.
What is the expected output? What do you see instead?
that the range sensor would work, I see many errors, while verifying.
What version of the product are you using? On what operating system?
5.1 4.1 tried them both.
Please provide any additional information below.
is there a simple way to get and record data from the HC-SRO4
Original issue reported on code.google.com by [email protected]
on 21 Sep 2012 at 1:24
I am using the HC-SR04, everything works fine, but when I try to play a buzzer
with tone() function give me an error.
Error: core.a(Tone.cpp.o): In function `__vector_7':
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Tone.cpp:535:
multiple definition of `__vector_7'
NewPing\NewPing.cpp.o:C:\Program Files
(x86)\Arduino\libraries\NewPing/NewPing.cpp:214: first defined here
Original issue reported on code.google.com by [email protected]
on 12 Sep 2013 at 6:21
What steps will reproduce the problem?
1. connecting HC SR04 sensors to arduino due
2. Trying to compile any example of new ping library
3.
What is the expected output? What do you see instead?
It should compile and load, instead I see along list of errors
What version of the product are you using? On what operating system?
new ping 1.5 on arduino 1.5.5, Windows 8.1 x64
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 6 Dec 2013 at 3:13
when using ping_timer and check_timer, a timeout condition leaves ping_result
variable at whatever the last reading was. Setting ping_result=_maxEchoTime;
would define ping_result as "at or beyond the configured max" which is what a
timeout actually means.
Original issue reported on code.google.com by [email protected]
on 28 Feb 2014 at 4:26
What steps will reproduce the problem?
1. #include <NewPing.h>
2. Use tone() function
3.
What is the expected output? What do you see instead?
When compiling arduino sketch got the error:
core.a(Tone.cpp.o): In function `__vector_7':
C:\Program Files\Arduino\hardware\arduino\cores\arduino/Tone.cpp:535: multiple
definition of `__vector_7'
NewPing\NewPing.cpp.o:D:\Documents and Settings\My
Documents\Arduino\libraries\NewPing/NewPing.cpp:214: first defined here
What version of the product are you using? On what operating system?
Arduino 1.0.5
NewPing_v1.5
Please provide any additional information below.
Tone.cpp:535
#ifdef USE_TIMER2
ISR(TIMER2_COMPA_vect)
NewPing.cpp:214
#if defined (__AVR_ATmega32U4__) // Use Timer4 for ATmega32U4 (Teensy/Leonardo).
ISR(TIMER4_OVF_vect) {
#else
ISR(TIMER2_COMPA_vect) {
#endif
Original issue reported on code.google.com by [email protected]
on 3 Feb 2014 at 10:16
I think a simple tweak would make NewPing's timer-driven mode easier to work
with.
Inside my echoCheck() function, I do nothing but update a global variable with
the ping distance result. Because check_ping() returns same value for "still
waiting" and "timed out", I can't use that to update the global to zero after a
timeout. This means the global always reflects the last *good* ping attempt, so
I have to clear it (set it to zero) every time I test it.
NewPing is already keeping track of the last good ping attempt in ping_result,
but it's doing exactly what I'm doing... just updating when there's a
successful ping and never setting it back to zero.
If check_ping()'s timeout code would set ping_result to zero, then I could
eliminate my global variable (and the need to zero it out) and simply look at
ping_result. ping_result is used nowhere else in the code, so setting it to
zero should have no undesirable side-effects inside NewPing.
boolean NewPing::check_timer() {
if (micros() > _max_time) { // Outside the timeout limit.
timer_stop(); // Disable timer interrupt
ping_result = 0; // Last ping timed out
return false; // Cancel ping timer.
}
...
Alternately, check_timer() could return an int, returning -1 for "still
waiting", 0 for "timed out" and a positive number for distance. But this would
change the API and affect existing code.
Original issue reported on code.google.com by [email protected]
on 22 Feb 2013 at 10:49
What steps will reproduce the problem?
1. upload the NewPingExample
2. hook up the logic analyzer
What is the expected output? What do you see instead?
Please look at the attached screenshots.
The trig pin goes HIGH when the code is not supposed to turn on trig.
The problem seems to be missing code to check whether trig and echo are really
assigned to one pin in NewPing::ping_trigger().
setting DISABLE_ONE_PIN solves the problem.
What version of the product are you using? On what operating system?
Arduino Uno & Mega 2560
NewPing v1.5
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 8 Mar 2014 at 4:02
Attachments:
What steps will reproduce the problem?
#define TRIGGER_PIN 12 // Arduino pin tied to trigger pin on the ultrasonic
sensor.
#define ECHO_PIN 11 // Arduino pin tied to echo pin on the ultrasonic
sensor.
#define MAX_DISTANCE 400 // Maximum distance we want to ping for (in
centimeters). Maximum sensor distance is rated at 400-500cm.
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins
and maximum distance.
unsigned int cm = sonar.ping_cm(); // Send ping, get ping distance in cm.
lcd.print(cm);
lcd.print(" cm ");
What is the expected output? What do you see instead?
I should be messure 10cm and i get 5.
What version of the product are you using? On what operating system?
1.5
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 2 Jan 2013 at 6:50
What steps will reproduce the problem?
1. Include both <ArduinoRobot.h> and <NewPing.h>
What is the expected output? What do you see instead?
Doesn't work with two sensors. Although the first one returns an int containing
the distance in cm, the second one always returns zero.
What version of the product are you using? On what operating system?
Arduino 1.0.5 on Windows 7 64bit.
Original issue reported on code.google.com by [email protected]
on 18 Nov 2013 at 3:01
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.