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.
10 years, 8 months ago.
How to use PortOut with the FRDM-KL05Z
I am trying to write to pins 0 - 10 of port B of this kl05z platform at a go unsuccessfully, the code in the example doesn't compile I have this
I have my code as in this snippet
#include "mbed.h" #define LED_MASK 0xfff PortOut ptb(PTB, LED_MASK); int main(){ while (true) { ptb = LED_MASK; wait(0.5); ptb = 0; wait(0.5); } }
how is Port B, or any other port defined in the headers because PortOut expects the first argument to be a port definition?
I get this error:
Error: No instance of constructor "mbed::PortOut::PortOut" matches the argument list in "main.cpp", Line: 4, Col: 13
1 Answer
10 years, 8 months ago.
The names are PortA, PortB, etc. Then it compiles at least for me. Good chance no one actually tested this after the code was refactored, it should definately work, but please report back if it does :).
Yes!! thanks Erik, thank you so much, that works. So if I may ask, in which file are these ports (PortA, PortB) defined?
posted by 26 Feb 2014Somewhere deep in the source code ;)
And yeah I now see it is in the common KLXX code, don't try to use other ports than A and B for the KL05, it will compile, and most likely crash immediatly.
posted by 26 Feb 2014