NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » Define an array of Pin difentions
March 19, 2021 by scootergarrett |
I use the BV.h header to set and clear pins. I would like to do some setting and clearing of pins in a loop, and it would be nice if I could put all my pin definitions into an array so I could loop through them with a signal command Something like this:
the preprocessor doesn't like passing the pins definitions like this. I see the Arduino can do this because there pin definitions are just a number. dose anyone have a good handle on preprocessor with pin definitions? |
---|---|
March 27, 2021 by sask55 |
Hi I think the problem is with your #define statement
I don't think that is valid use of #define It looks like the SET function is expecting a char and a int as arguments. In the example the char remains constant "D", only the int argument changes. something like this may work
or even more directly don't use #define or an array at all
|
March 27, 2021 by scootergarrett |
Thanks for the input. Your idea works until I change the pin from D3 to another port, say C0. |
Please log in to post a reply.
Did you know that our kits have shipped to hobbyists in 40 countries? Learn more...
|