How an Arduino Program Works
You need to know the meaning of the following things
void setup(){
}
runs once, when the Arduino is powered on.
void loop(){
}
runs continuously after the setup() has completed.
– here we check for voltage level on the inputs, and turn on/off the outputs.