modify setup() from a class

I'm thinking about making a class that automates setting up & reading from buttons. Would it be possible to set my pinModes (which & how many pins) dynamically? Can I modify setup() from a class?

Gabe

you can use pinmode anywhere in your code... you dont need to modify setup to do that

or make a class that has a method that gets executed in setup() and you can make some last nanosecond changes to the code

massimo

I think newcomers to Arduino will find it quite helpful and revealing to study the startup code in:

lib/targets/arduino/wiring.c

For example, if you look at main(), you see a bunch of hardware initialization stuff, and at the very end you see:

setup();

for (;:wink:
loop();

Then it becomes very apparent that there is nothing special about what you can do in setup() vs loop().