Pages: [1]   Go Down
Author Topic: void Setup()... Loop() but exist others first...  (Read 854 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 0
Posts: 205
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello

Few months ago I found a topic here about some hide voids...
Now I can't found it...

Before Setup() and Loop() exist 2, 3 hide voids...

If somebody know some about them, please let me know.

Thanks on advance
Best regards
Pedro Ferrer
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Few months ago I found a topic here about some hide voids...
void is a function return type, not some kind of object on its own.

Can you clarify what you are asking about?
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 205
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Paul

Thanks by your reply.
As I remember, exist some procedures, voids... something, that starts first than Setup and Loop voids...

Thanks on advance
Best regards
Pedro Ferrer
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17262
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
As I remember, exist some procedures, voids... something, that starts first than Setup and Loop voids...

What did the 'void something' suppose to accomblish? That could just be any user written function that could perform any possible operation, so that's not likely to gain you a answer that might be useful.


Lefty


Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 205
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello retrolefty

Thanks by your reply.
Something... as something else... isn't a name of any void... smiley

Thanks on advance
Best regards
Pedro Ferrer
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 72
Posts: 7171
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe you were referring to the main() that is not shown in arduino IDE but is later patched to the code? It has no importance to most projects. All it does it to call setup and loop the loop.
Logged


Bristol, UK
Offline Offline
Edison Member
*
Karma: 1
Posts: 1197
Exhibitor at UK Maker Faire
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you thinking of the 'main' function, that runs before 'setup' and 'loop'? In fact, 'main' calls 'setup' once and then repeatedly calls 'loop'.
Logged

New Jersey
Offline Offline
Faraday Member
**
Karma: 65
Posts: 3638
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you talking about the massaged cpp program that the IDE sends to the complier? IIRC, it's something like:
Code:
int main()
{
init();
setup();
while(1)
  loop();
}

Edit: beaten by 6s
Logged

0
Offline Offline
Full Member
***
Karma: 0
Posts: 205
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello wildbill

Code:
int main()
{
init();
setup();
while(1)
  loop();
}

Perhaps is that!
So...

Can I edit 'int main' ?
I'm asking because I wonder if I can change PWM values... since by defaut PWM is 255... using 'int main' I can change to '0' before Arduino 'starts' really?
I'll explain better. I'm using a relay to avoid led flashing. Others use a Mosfet to do the same... because some drivers with PWM 255 means 100% of power...
Change 'int main' avoid the relay and mosfet ?

Please let me know
Thanks on advance
Best regards
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 72
Posts: 7171
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Why not put something in setup()?
Logged


0
Offline Offline
Full Member
***
Karma: 0
Posts: 205
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello liudr

Why not put something in setup()?

On that moment a flashing already occurred... i suppose...

Best regards
Pedro Ferrer
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

On that moment a flashing already occurred... i suppose...

What flashing? Until you tell it to, the pins are all inputs. Perhaps post your code?
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 524
Posts: 26442
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If the PWM floating on startup is being seen as a high, you can add a 10K pulldown resistor from the PWM pin to ground, then the pin will stay low until your sketch starts up & programs it as an output  ...
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Pages: [1]   Go Up
Jump to: