Go Down

Topic: modify setup() from a class (Read 563 times) previous topic - next topic


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?



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



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


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

   for (;;)

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

Go Up