0% found this document useful (0 votes)
108 views9 pages

Arduino Expo

This document provides instructions on how to program an Arduino board. It describes the basic parts of an Arduino board including the USB connector, reset button, and analog and digital input/output pins. It then explains some common Arduino programming concepts like pinMode, digitalWrite, digitalRead, and delay. Examples are given to blink an LED using digitalWrite and delay, create parking lights using two pins, and use if statements to trigger different blink patterns based on different digital input pin states.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views9 pages

Arduino Expo

This document provides instructions on how to program an Arduino board. It describes the basic parts of an Arduino board including the USB connector, reset button, and analog and digital input/output pins. It then explains some common Arduino programming concepts like pinMode, digitalWrite, digitalRead, and delay. Examples are given to blink an LED using digitalWrite and delay, create parking lights using two pins, and use if statements to trigger different blink patterns based on different digital input pin states.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 9

How To Program an Arduino

John Aldemar Rubiano


Carlos Andrés Torregrosa
Parts of an Arduino
Digital Input/Output

USB
connector

Reset button

Connection
Jack 7v - 12v
Analog Inputs
• Vin = 5v supply
• Pins 3,3v- 5v
outputs supplies
Keep it Mind
The instructions are in lower case, but
when the instruction has 2 words, The
first word is in lower case, but the initial
letter of the second word is a capital
letter.

For example like in the instruction


pinMode, digitalWrite, digitalRead, etc.
digitalWrite

void setup() {
pinMode(13,OUTPUT);
}

void loop() {
digitalWrite(13,HIGH);
}
delay

void setup() {
pinMode(13,OUTPUT);
}

void loop() {
digitalWrite(13,HIGH);
delay(500);
digitalWrite(13,LOW);
delay(500);
}
Delay example: parking lights

void setup() {
pinMode(10, OUTPUT);
pinMode(13, OUTPUT);
}

void loop() {
digitalWrite(13,HIGH);
delay(200);
digitalWrite(13,LOW);
delay(200);
digitalWrite(10,HIGH);
delay(200);
digitalWrite(10,LOW);
delay(200);
}
If sentence

void setup() {
pinMode(8, INPUT);
pinMode(13, OUTPUT);
}

void loop() {
if(digitalRead(8)==HIGH) {
digitalWrite(13,HIGH);
}
else {
digitalWrite(13,LOW);
}
}
If sentence and delay
void setup() {
pinMode(8, INPUT);
pinMode(13, OUTPUT);
}

void loop() {
if(digitalRead(8)==HIGH) {
digitalWrite(13,HIGH);
delay(100);
digitalWrite(13,LOW);
delay(100);
}
else {
digitalWrite(13,HIGH);
delay(1000);
digitalWrite(13,LOW);
delay(1000); }
}
If sentence and differents blinks
void setup() {
pinMode(8, INPUT);
pinMode(9, INPUT);
pinMode(10, INPUT);
pinMode(13, OUTPUT); }

void loop() {
if(digitalRead(8)==HIGH){
digitalWrite(13,HIGH);
delay(50);
digitalWrite(13,LOW);
delay(50); }
else{
if(digitalRead(9)==HIGH){
digitalWrite(13,HIGH);
delay(250);
digitalWrite(13,LOW);
delay(250); }
else{
if(digitalRead(10)==HIGH) {
digitalWrite(13,HIGH);
delay(500);
digitalWrite(13,LOW);
delay(500); }
else {
digitalWrite(13,LOW);
}}}}

You might also like