-
-
Notifications
You must be signed in to change notification settings - Fork 212
"undefined reference" when compiling sketches that use pulseIn() for Portenta H7 boards #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@per1234 can we have an update on this? I am trying to get an UltraSonic Rangefinder working and it uses pulseIn(). I feel that this function could be done from scratch. If it is not yet implemented I think a work around would not be very hard to make. |
I am not getting any sensible values for either pulseIn() or pulseInLong() on the Portenta. The typical Arduino example does nothing
and a more advanced example loses the serial port
and pulseInLong() seems to also not give any useful values with a rangefinder
Can anyone give an example of pulseIn() on the Portenta that gives any data? |
👋 int pin = 7;
unsigned long duration;
void setup() {
Serial.begin(9600);
pinMode(pin, INPUT_PULLDOWN);
analogWrite(6, 12);
}
void loop() {
duration = pulseIn(pin, HIGH);
Serial.println(duration);
delay(10);
} then short pins 6 and 7 and you should get 95us pulses correctly printed. This is only needed if you want to print the values; in case you just want to use them to trigger another function there's no need for the delay and the function can run at full speed. About the rangefinder, I don't have an ultrasonic sensor at hand right now but I can get tested by a colleague and report back 😉 |
@facchinm Thank you so much for helping with this little issue. Your code works perfectly. I should be able to solve my RangeFinder issue now, since I have a starting point. Here is the type of rangefinder I have an HC-SR04 which works on other boards. A few hours later..... Since @facchinm proved pulseIn() works this problem should probably be in the arduino forum not here as an issue, but if anyone can get pulseIn() working with a rangeFinder that would be appreciated. It should be so easy. The following code should work with the HC-SR04 range finder, but does not compile for me with the Nano33BleSense, and only shows zeros for both the RP2040 and Portenta. Very likely I have done something wrong but if anyone has any suggestions?
|
I put this RnageFinder question on the Arduino forum at https://forum.arduino.cc/t/portenta-ultrasonic-rangefinder-hc-sr04/875414 |
pulseIn()
has not yet been implemented for the Portenta.The text was updated successfully, but these errors were encountered: