0% found this document useful (0 votes)
2 views11 pages

Arduino - Uno - Programming - Basics Le No 5

The document provides an introduction to Arduino UNO programming, outlining basic programming rules, variable types, and key functions such as pinMode(), digitalWrite(), and delay(). It includes examples of code and explanations, particularly focusing on a simple LED blinking program. The content is aimed at beginners looking to understand the fundamentals of Arduino programming.

Uploaded by

rk7868680
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views11 pages

Arduino - Uno - Programming - Basics Le No 5

The document provides an introduction to Arduino UNO programming, outlining basic programming rules, variable types, and key functions such as pinMode(), digitalWrite(), and delay(). It includes examples of code and explanations, particularly focusing on a simple LED blinking program. The content is aimed at beginners looking to understand the fundamentals of Arduino programming.

Uploaded by

rk7868680
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

INTRODUCTION TO ARDUINO

UNO PROGRAMMING
• Basic Rules
• Variables
• Functions
BASIC PROGRAMMING RULES

• 1. Every Arduino program has void setup() and void loop()


• 2. Program runs in a linear (top-to-bottom) fashion
• 3. Use { } curly brackets to define code blocks
• 4. Code is case-sensitive
• 5. Use // to add single-line comments
• 6. End every statement with a semicolon ;
VARIABLES IN ARDUINO

• Definition:Variables are used to store information to be referenced & manipulated in


a program.

• Declaration Requires:
• - Data Type
• - Variable Name
• - Initial Value (optional)

• Example:
• int ledPin = 13;
TYPES OF VARIABLES

• 1. Global Variable
• - Declared outside any function
• - Accessible throughout the program

• 2. Local Variable
• - Declared inside a function
• - Only accessible within that function
PINMODE() FUNCTION

• Purpose: Sets a pin as input or output

• Syntax:
• pinMode(pin, mode);

• - pin: Arduino pin number


• - mode: INPUT or OUTPUT

• Example:
• pinMode(13, OUTPUT);
DIGITALWRITE() FUNCTION

• Purpose: Writes HIGH or LOW to a digital pin

• Syntax:
• digitalWrite(pin, value);

• - pin: Arduino pin number


• - value: HIGH or LOW

• Example:
• digitalWrite(13, HIGH);
DELAY() FUNCTION

• Purpose: Pauses the program for a set time (in milliseconds)

• Syntax:
• delay(ms);

• - ms: time in milliseconds

• Example:
• delay(1000);
BLINK EXAMPLE CODE

• void setup() {
• pinMode(LED_BUILTIN, OUTPUT);
• }

• void loop() {
• digitalWrite(LED_BUILTIN, HIGH);
• delay(1000);
• digitalWrite(LED_BUILTIN, LOW);
• delay(1000);
• }
BLINK CODE EXPLANATION

• - setup() runs once: sets LED as output


• - loop() runs repeatedly:
• - Turns LED on → waits 1 second
• - Turns LED off → waits 1 second
• - This creates a blinking effect
THANK YOU

• Questions?

You might also like