9 years, 4 months ago.

Does DigitalOut have a second parameter?

From the handbook and header files I see that the DigitalOut constructor should take a second argument giving the initial pin state, and it appears to be an integer.

When I try this today (I'm convinced it compiled once yesterday) the line:

DigitalOut sel(p22,1);

fails with: Error: No instance of constructor "mbed::DigitalOut::DigitalOut" matches the argument list in "main.cpp", Line: 31, Col: 17

Is the documentation wrong or am I declaring it incorectly? I would prefer if the pin went straight to "high" as letting it default low then driving it high later could cause a false transition.

    /** Create a DigitalOut connected to the specified pin
     *
     *  @param pin DigitalOut pin to connect to
     *  @param value the initial pin value
     */
    DigitalOut(PinName pin, int value) : gpio() {
        gpio_init_out_ex(&gpio, pin, value);
    }

1 Answer

9 years, 4 months ago.

Right mouse button on your mbed lib, click update. It should work, but it has been added a year ago or something, so older mbed versions do not have it.

Accepted Answer

OK: Still trying to work out how a new program would have an old lib?

I think I made the mistake of importing Serial_HelloWorld as a template so I have "inherited" the mbed libs from when that last updated. I also am stuck with my program showing as a fork of that example which it really isn't.

posted by Oliver Broad 19 Apr 2016

That indeed is the reason you have an old version, if you make a new program using the new button you do get the latest one automatically.

I don't know if there really is a way to break the 'fork of' thing without making a new program and copying your files there.

posted by Erik - 19 Apr 2016