arduino: fundamentals and coding - engineering.tiu.edu.iq
TRANSCRIPT
![Page 1: Arduino: Fundamentals and Coding - engineering.tiu.edu.iq](https://reader033.vdocuments.mx/reader033/viewer/2022053120/62922a9e5932bc61026db274/html5/thumbnails/1.jpg)
Arduino: Fundamentals and Coding
Mechatronics Department TIUI
01.0
Dr Ezideen A Hasso
![Page 2: Arduino: Fundamentals and Coding - engineering.tiu.edu.iq](https://reader033.vdocuments.mx/reader033/viewer/2022053120/62922a9e5932bc61026db274/html5/thumbnails/2.jpg)
Different types of Arduino’s
![Page 3: Arduino: Fundamentals and Coding - engineering.tiu.edu.iq](https://reader033.vdocuments.mx/reader033/viewer/2022053120/62922a9e5932bc61026db274/html5/thumbnails/3.jpg)
Synopsis Arduino is a single board microcontroller based on a single
Integrated Circuit chip.
• There are variety of them, but this course will concentrate
on the Arduino Uno.
• The Arduino’s are open-source software open-source
hardware.
• They are widely used for education and hobbyists due to
low cost and availability.
![Page 4: Arduino: Fundamentals and Coding - engineering.tiu.edu.iq](https://reader033.vdocuments.mx/reader033/viewer/2022053120/62922a9e5932bc61026db274/html5/thumbnails/4.jpg)
![Page 5: Arduino: Fundamentals and Coding - engineering.tiu.edu.iq](https://reader033.vdocuments.mx/reader033/viewer/2022053120/62922a9e5932bc61026db274/html5/thumbnails/5.jpg)
RESETRESET2AREFioref
A0A1A2A3A4/SDAAS/SCL
N/C
D13 D12 D11 D10 D9 D8D7D6 D5 D4D3 D2D1 D0
GND
3V
3
5V
VIN
SCKMISOPWM/MOSIPWM/SSPWM
PWMPWM
PWM
TXRX
Arduino Uno
Schematic Pin
Diagram
![Page 6: Arduino: Fundamentals and Coding - engineering.tiu.edu.iq](https://reader033.vdocuments.mx/reader033/viewer/2022053120/62922a9e5932bc61026db274/html5/thumbnails/6.jpg)
![Page 7: Arduino: Fundamentals and Coding - engineering.tiu.edu.iq](https://reader033.vdocuments.mx/reader033/viewer/2022053120/62922a9e5932bc61026db274/html5/thumbnails/7.jpg)
![Page 8: Arduino: Fundamentals and Coding - engineering.tiu.edu.iq](https://reader033.vdocuments.mx/reader033/viewer/2022053120/62922a9e5932bc61026db274/html5/thumbnails/8.jpg)
Static Charge
Electronic components are sensitive to static chargesand needs to be handled carefully otherwise could be
damaged. Discharging of tactile surfaces that are going
to be in physical contact with these components is a
must for the safety and prevention of damage. For
these reasons we find that electronic components are
usually supplied in static envelops (pouches).
![Page 9: Arduino: Fundamentals and Coding - engineering.tiu.edu.iq](https://reader033.vdocuments.mx/reader033/viewer/2022053120/62922a9e5932bc61026db274/html5/thumbnails/9.jpg)
Installing Arduino
The Arduino boards need a development system where all the work is: performed; sketches (program or codes) are created and edited; compiled; and finally uploaded to the Arduino boards to be executed to conduct the intended tasks. To install Arduino software simply go to google and type the following:
![Page 10: Arduino: Fundamentals and Coding - engineering.tiu.edu.iq](https://reader033.vdocuments.mx/reader033/viewer/2022053120/62922a9e5932bc61026db274/html5/thumbnails/10.jpg)
<Arduino downloads>
The response will be something like this:
![Page 11: Arduino: Fundamentals and Coding - engineering.tiu.edu.iq](https://reader033.vdocuments.mx/reader033/viewer/2022053120/62922a9e5932bc61026db274/html5/thumbnails/11.jpg)
Windows 10
Click on the link:
![Page 12: Arduino: Fundamentals and Coding - engineering.tiu.edu.iq](https://reader033.vdocuments.mx/reader033/viewer/2022053120/62922a9e5932bc61026db274/html5/thumbnails/12.jpg)
Arduino IDE:
IDE, can be considered as the operating theatre:
•Write
•Edit
•Compile
•Upload to Arduino board
![Page 13: Arduino: Fundamentals and Coding - engineering.tiu.edu.iq](https://reader033.vdocuments.mx/reader033/viewer/2022053120/62922a9e5932bc61026db274/html5/thumbnails/13.jpg)
IDE front page
![Page 14: Arduino: Fundamentals and Coding - engineering.tiu.edu.iq](https://reader033.vdocuments.mx/reader033/viewer/2022053120/62922a9e5932bc61026db274/html5/thumbnails/14.jpg)
Adamant to Write Your First Program Today
Do the Following Steps:
• <File>
• <Examples>
• <Basics>
• <BareMinimum>
![Page 15: Arduino: Fundamentals and Coding - engineering.tiu.edu.iq](https://reader033.vdocuments.mx/reader033/viewer/2022053120/62922a9e5932bc61026db274/html5/thumbnails/15.jpg)
Choosing Board Type and Port
![Page 16: Arduino: Fundamentals and Coding - engineering.tiu.edu.iq](https://reader033.vdocuments.mx/reader033/viewer/2022053120/62922a9e5932bc61026db274/html5/thumbnails/16.jpg)
Exercise 1
void setup() {
// put your setup code here, to run once:
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
}
void loop() {
// put your main code here, to
}
void setup() {
// put your setup code here, to run once:
pinMode(13,OUTPUT);
digitalWrite(13,HIGH);
delay(1000);
digitalWrite(13,LOW);
}
void loop() {
// put your main code here, to run repeatedly:
}
Change to “LOW”
Exercise 2
Add Delay
![Page 17: Arduino: Fundamentals and Coding - engineering.tiu.edu.iq](https://reader033.vdocuments.mx/reader033/viewer/2022053120/62922a9e5932bc61026db274/html5/thumbnails/17.jpg)
Serial Port/*
Serial Port Usage
*/
void setup() {
// put your setup code here, to run once:
Serial.begin(9600); // define the Bps
Serial.print("The Mechatronics Engineering");
Serial.println("Would like to:\n welcome you all");
}
void loop() {
// put your main code here, to run repeatedly:
}
Control Charecter “\n”
![Page 18: Arduino: Fundamentals and Coding - engineering.tiu.edu.iq](https://reader033.vdocuments.mx/reader033/viewer/2022053120/62922a9e5932bc61026db274/html5/thumbnails/18.jpg)
Serial.println("The Mechatronics Engineering");
Serial.print("The Mechatronics Engineering");
Copy and paste the Serial instruction to the void loop
and see the outcome
Change to “print”
![Page 19: Arduino: Fundamentals and Coding - engineering.tiu.edu.iq](https://reader033.vdocuments.mx/reader033/viewer/2022053120/62922a9e5932bc61026db274/html5/thumbnails/19.jpg)
The End