Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
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.
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 19 Apr 2016