How to read and understanding sketch arduino (Blinking LED)
This time i want to share how to read and understanding sketch in IDE software
for example Blinking LED.
void setup()
{
pinMode(13, OUTPUT); --> it means pin 13 is used as output
}
void loop()
{
digitalWrite(13, HIGH); --> Turn on pin 13. if connected to LED, LED will ON.
delay(1000); --> wait for 1000ms or 1 second. you can change with other value as you want.
digitalWrite(13, LOW); --> Turn off pin 13. if connected to LED, LED will OFF.
delay(1000); --> wait for 1000ms or 1 second. you can change with other value as you want.
}
Or you can type the sketch as this. which is the meaning is same function.
int LED = 13; --> Pin 13 is named as LED.
void setup()
{
pinMode(LED, OUTPUT); --> it means LED used as output
}
void loop()
{
digitalWrite(LED, HIGH); --> Turn on LED.
delay(1000); --> wait for 1000ms or 1 second. you can change with other value as you want.
digitalWrite(LED, LOW); --> Turn off LED.
delay(1000); --> wait for 1000ms or 1 second. you can change with other value as you want.
}
Booth algotitm is same in meaning and function.
You can use any method which is make you easy to learn and understanding.
If you understand every code you can make and modify any project.
Thanks a lot.
Yogi
for example Blinking LED.
void setup()
{
pinMode(13, OUTPUT); --> it means pin 13 is used as output
}
void loop()
{
digitalWrite(13, HIGH); --> Turn on pin 13. if connected to LED, LED will ON.
delay(1000); --> wait for 1000ms or 1 second. you can change with other value as you want.
digitalWrite(13, LOW); --> Turn off pin 13. if connected to LED, LED will OFF.
delay(1000); --> wait for 1000ms or 1 second. you can change with other value as you want.
}
Or you can type the sketch as this. which is the meaning is same function.
int LED = 13; --> Pin 13 is named as LED.
void setup()
{
pinMode(LED, OUTPUT); --> it means LED used as output
}
void loop()
{
digitalWrite(LED, HIGH); --> Turn on LED.
delay(1000); --> wait for 1000ms or 1 second. you can change with other value as you want.
digitalWrite(LED, LOW); --> Turn off LED.
delay(1000); --> wait for 1000ms or 1 second. you can change with other value as you want.
}
Booth algotitm is same in meaning and function.
You can use any method which is make you easy to learn and understanding.
If you understand every code you can make and modify any project.
Thanks a lot.
Yogi
Comments
Post a Comment