Setup function is the first function an Arduino program reads, and it runs only once. its all purpose is to set up the Arduino device, assigning values and properties to the board. so for example, we would like to set a specific pin number 13 to be digital OUTPUT. we will do that only one time, in the setup function. The second function, loop(), makes it possible for our sketch to run continuously and it will begin just after the last statement in the setup () function has finished executing.
when the Arduino runs a sketch, it starts at the top of the first line and than moves its way towards the bottom this is called "program flow" and refers to the order that the statements are executed one line after another looking in the simply code here, we are starting with setting the digital PIN#13 to HIGH level waiting for 1 second, that's the delay and than setting pin#13 to LOW level and than again, waiting for 1 second and loop back - start all over again.
How To Use Setup And Loop Function In Arduino Programming
December 12, 2018
0
Tags
Dear visitor. Click on "Follow" button from right side above and sign in with your Gmail account. Write unlimited comments on every post. 100% Free