Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
Arduino: Fundamentals and Coding
Mechatronics Department TIUI
01.0
Dr Ezideen A Hasso
Different types of Arduino’s
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.
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
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).
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:
<Arduino downloads>
The response will be something like this:
Windows 10
Click on the link:
Arduino IDE:
IDE, can be considered as the operating theatre:
•Write
•Edit
•Compile
•Upload to Arduino board
IDE front page
Adamant to Write Your First Program Today
Do the Following Steps:
• <File>
• <Examples>
• <Basics>
• <BareMinimum>
Choosing Board Type and Port
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
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”
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”
The End