saving . . . saved program doubt has been deleted. program doubt has been hidden .
program doubt
Title
Question
what is the need to write pinmode(13,output) ,because the below void loop is running continuously with input(13,high) then why we are writing the setup function code.
I cant understand what is the purpose of setup function and what is it doing please explain

Arduino First-Arduino-Program 02-03 min 50-60 sec 29-04-23, 6:32 a.m. meenatchisundaramm_bee25@mepcoeng.ac.in

Answers:

In the setup function, we denote the pins connected to any sensor as output or input. 
The setup function is necessary for the void loop() code to understand which pin/sensor connected is acting as an INPUT or OUTPUT
Since we are demonstrating the LED, and LED being a device which gives visual representation and changes the value according to the input provided, we denote the pin 13 as OUTPUT. Few output sensor example will be, buzzer, RGB LED etc.

Likewise, if we require a sensor to read a data from its surrounding and fed it to the Arduino, in that case, we would write INPUT instead of OUTPUT.
29-04-23, 10:01 a.m. Pratikjb11


Log-in to answer to this question.