Pinguino Forum

Full Version: (SOLVED)[Library] Only one pulseIn() constructor recognized ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys,

I have a little problem with the function pulseIn().

On the pulseIn() page in the Arduino language's documentation we can see that pulseIn() has two constructor: pulseIn(pin, value) and pulseIn(pin, value, timeout), where timeout is, in fact, an optional parameter.

so, when I do (for example):

Code:
... (some definitions)
#define echoPin 6

long duration;

setup()
{
   ...
   pinMode(echoPin, INPUT);
   ...
}

loop()
{
   ...
   duration = pulseIn(echoPin, HIGH);
   ...
}

It will not work; I must write : duration = pulseIn(echoPin, HIGH, 1000)

I know, it's no big deal, but I just wanted to note that. ^^

Sorry if this thread is in the wrong section.

Flaco
Arduino uses C++ and Pinguino uses C.
C doesn't allow optional argument. The only way would be to declare each function as a varargs function. Not sure it's a good idea.
This is one of the reason why Pinguino will never be 100% compatible with Arduino.
Smile Okay; I see!
Thank you regis!