Go Down

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

Gabe462

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

admin

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

CosineKitty

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 (;;)
       loop();

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

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy