Introduction to Arduino IDE and Software

Slides:



Advertisements
Similar presentations
Khaled A. Al-Utaibi Interfacing an LED The Light Emitting Diode (LED) Applications DC Characteristics & Operation Interfacing to.
Advertisements

EMS1EP Lecture 4 Intro to Programming Dr. Robert Ross.
ARDUINO CLUB What we’re really doing. BASICS The setup() and loop() functions.
Lab7: Introduction to Arduino
ARDUINO FRAMEWORK.
How to use Arduino By: Andrew Hoffmaster.
Embedded Sumo 1T4 – 1T5 UTRA.
Re-programming the Simon Says with Arduino Linz Craig, Brian Huang.
1 Arduino Board: Arduino UNO Arduino Programing Environment: Arduino 0022
1 Introduction to Coding. 2 Example Codes A lot of example codes are given with Arduino IDE A code can often be based on a previous example rather than.
 Main Components:  Sensors  Micro controller  Motor drivers  Chasis.
ARDUINO PROGRAMMING Working with the Arduino microcontroller.
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
Arduino Part 1 Topics: Microcontrollers Programming Basics: structure and variables Digital Output Analog to Digital Conversion.
Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009 Using Arduino Material taken from Todbot blog Bionic Arduino Todbot blog Bionic ArduinoTodbot.
chipKit Sense Switch & Control LED
Intro to the Arduino Topics: The Arduino Digital IO
Microprocessors Tutorial 1: Arduino Basics
Arduino. What is it? A open-source software suite and single-board microcontroller. Allows easy and affordable prototyping of microcontroller applications.
Introduction to the Arduino
Khaled A. Al-Utaibi  The Push Button  Interfacing Push Buttons to Arduino  Programming Digital Inputs  Working with “Bouncy”
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
Microprocessors Tutorial 1: Arduino Basics
1 Introduction to Haptics Introduction to the Hapkit board Allison M. Okamura Stanford University.
ME 120: Arduino Programming Arduino Programming Part II ME 120 Mechanical and Materials Engineering Portland State University
Programming in Arduino Materials:Arduino Board Casperelectronics Pre Pres. Notes Photos from workshop?
Arduino “Getting Started” Instructor : Dr Matthew Miss Khin Yi Kyaw
1 Introduction to Coding. 2 Example Codes A lot of example codes are given with Arduino IDE A code can often be based on a previous example rather than.
Arduino.
Arduino Part 1 Topics: Microcontrollers
Embedded Systems Intro to the Arduino
Getting Started: Building & Programming
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
European Robotic LABoratory
By Rick Darby Sponsors: Geekspace Gwinnett The WorkSpot
Microcontroller basics
Dr. Kyung Eun Park Summer 2017
Val Manes Department of Math & Computer Science
Downloading Arduino FOR WINDOWS.
Microcontroller basics
Introduction to the Arduino
Arduino & its hardware interfacing
UTA010 : Engineering Design – II
An Arduino Workshop A Microcontroller.
Welcome to Arduino A Microcontroller.
UCD ElecSoc Robotics Club 2017/2018
Arduino Part 1 Topics: Microcontrollers Programming Basics
INC 161 , CPE 100 Computer Programming
3.0 ARDUINO WORKSHOP PRESENTATION FOR STUDENTS IN 4º DEGREE OF COMPULSORY SECONDARY EDUCATION 3.0.
Lecture 2-2: Arduino Programming
Introduction to Arduino Microcontrollers
Introduction to Arduinos
Roller Coaster Design Project
Intro to the Arduino Topics: The Arduino Digital IO
Working with Arduino: Lesson #1: Getting Acquainted with the Kit
Welcome to Digital Electronics using the Arduino Board
Arduino programs Arduino toolchain Cross-compilation Arduino sketches
Intro to the Arduino by Someet Singh
CTY SAR FCPS Shawn Lupoli, Elliot Tan
I/O Programming with Arduino
Aeroponic Engineering and Vertical Farming
TI LaunchPad I/O Programming with Energia
Arduino Leonardo Setup
Lab #1: Getting Started.
Arduino Uno circuit basics
Introduction to Arduinos
SAURABH GINGADE.
UNIT 1 First programs.
Introduction to arduino
Arduino程式範例.
Presentation transcript:

Introduction to Arduino IDE and Software KH Wong Introduction to Arduino 190430a

Introduction to Arduino Arduino is a computation tool for sensing and controlling signals It is more convenient and cost effective than using a personal computer PC. It's an open-source system in terms of hardware and software. You can download the Integrated Development Environment (IDE) for your own OS from http://arduino.cc/en/Main/Software Follow the instruction to install the IDE Introduction to Arduino 190430a

Installation of the Arduino IDE Download Interactive Development Environment DE from https://www.arduino.cc/en/Main/Software Try this Or Select one of these Arduino experiments v19.5.29e

Arduino experiments v19.5.29e Arduino installation Browse https://www.arduino.cc/en/Main/Software Download and unzip https://www.arduino.cc/download.php?f=/arduino-nightly-windows.zip Run arduino.exe Connect the Arduino board (e.g. gen uno) to pc thou usb In the main menu IDE In menu IDE : Use “tool/port” to see the port , select the port. e.g. port6(arudio/genuino  uno) In menu IDE : File /example/o.1 basic/blink Copy the source to the main sketch window (program editor  screen) Use the “Sketch/verify/compile” (control R, or the icon ‘Ö’ on the menu bar) to compile the program. Use upload (control U, or ’->’ on the menu bar to upload the program to your board. Result: The led on the board is blinking. Note: Use this to find out where are your Arduino files Click Arduino IDE/File/Preference/Sketch_book_location/ Arduino experiments v19.5.29e

Introduction to Arduino 190430a Arduino UNO Microcontroller is based on ATmega328 If needed , download Arduino Integrated Development Environment IDE http://arduino.cc/en/Main/Software#toc1 14 digital input/output (I/O) pins plus 6 analog input pins (these pins can also be programmed to be digital I/O pins) A 16 MHz ceramic resonator 14 digital input/output (I/O) pins 13,12,… ………2,1,0 A0-A5 6 Analog inputs, they can also be used as digital I/O pins Introduction to Arduino 190430a

Start to use the Arduino IDE To start Arduino IDE, click Start Menu  All Programs  Arduino Make sure the board model (Arduino Uno) and connected port (depends on your PC) are correct Your board Model The port that your board connected to Introduction to Arduino 190430a

Introduction to Arduino 190430a Select Board Select a correct board Introduction to Arduino 190430a

Introduction to Arduino 190430a Select Port Select a correct port. The actual number depends on your system. Introduction to Arduino 190430a

Arduino IDE (integrated development environment ) Serial monitor, Can use this to issue commands to the board, and read outputs from the board. Tool Bar This programming Area is called “Sketch”. The program code are placed here. Status Message Messages from the system Introduction to Arduino 190430a

Introduction to Arduino 190430a Toolbar Verify Checks code for errors Upload Compiles and uploads code to the Arduino I/O board New Creates a new sketch Open Open sketch Save Save sketch Serial Monitor Display serial data being sent from the Arduino board Introduction to Arduino 190430a

Introduction to Arduino 190430a Arduino Code To run a program in Arduino, your sketch should contain two methods void setup() { // initialization of variables, pin modes, libraries // run once after each power up or reset } void loop() // loops the content consecutively // allowing the program to change and respond Introduction to Arduino 190430a

Basic software functions Hardware related pinMode(), setup the functions of hardware pins digitalWrite(), set a pin to a digital level : ‘1’ or ‘0’ digitalRead(), read the digital level of a pin: ‘1’ or ‘0’ delay() Software related If-then-else For Switch-case Introduction to Arduino 190430a

System setup procedures (Step 1) Setup the direction of the pins: using pinMode(), (Step 2) Then you can set a pin to : HIGH or LOW (Step 2a) digitalWrite(), //set pin to : HIGH ‘1’ or LOW ‘0’ or (step 2b) digitalRead(), //read state of pin: HIGH ‘1’ or LOW ‘0’ Introduction to Arduino 190430a

Basic Function (step1) – pinMode() pinMode() is used to configure the specified pin to behave either as an input or output, or input_pullup Syntax pin: the index number of the pin whose mode you wish to set mode: INPUT, OUTPUT, INPUT_PULLUP Example: pinMode(1, OUTPUT)//setup pin1 =digital out pinMode(3, INPUT)//setup pin3 =digital in pinMode(A3, INPUT)//setup A3 for digital in pinMode(A3, OUTPUT)//setup A3 for digital out If no PinMode applied to A0->A5, they are analog_in by default. Pin =0,..,13, or A0,A1,..,A5 for Digital I/O, or Write comment for you to read pinMode(pin, mode) // comment Introduction to Arduino 190430a

Meaning of INPUT, OUTPUT, INPUT_PULLUP HIGH(5V) or LOW(0V) Arduino INPUT: OUTPUT: INPUT_PULLUP: When the pin is not connect to anything, it is HIGH Arduino HIGH(5V) or LOW (0V) High(5V)) 1KΩ Arduino HIGH(5V) or LOW) or not_connected_to_anything Introduction to Arduino 190430a

Basic Function(step2a) – digitalWrite() digitalWrite() is used to write a HIGH or a LOW value to a digital pin Syntax pin: the number of the pin whose value you wish to set value: HIGH (5 V) or LOW (Ground) Example: digitalWrite(pin, value) // comment E.g digitalWrite(1, HIGH)//set pin1 to HIGH digitalWrite(pin, value) // comment Introduction to Arduino 190430a

Basic Function(step2b) – digitalRead() digitalWrite() is used to read the value from a specified digital pin, either HIGH or LOW Syntax pin: the number of the pin whose mode you want to read (integer) Example: digitalRead(pin)// read the state of the // it can be “HIGH” or “LOW” digitalRead(pin) Introduction to Arduino 190430a

Some other basic Function – delay() delay() is used to pause the program for the amount of time (in milliseconds) Syntax ms: the number of milliseconds to pause (unsigned long) delay(ms) Introduction to Arduino 190430a

Basic Control Structure – IF Syntax IF(condition1){ // do stuff if condition1 is true }ELSE IF (condition2){ // do stuff only if condition1 is false // and conition2 is true }ELSE{ // do stuff when both condition1 and // condition2 are false } Introduction to Arduino 190430a

Basic Control Structure – FOR Syntax FOR(initialization; condition; increment){ // statement(s); } Introduction to Arduino 190430a

Basic Control Structure – SWITCH-CASE switch (var) { case label1: // statements when var=label1 break; case label2: // statements when var=label2 default: // statements } Introduction to Arduino 190430a

Introduction to Arduino 190430a More Functions Please visit http://arduino.cc/en/Reference/ for Arduino Language Reference Introduction to Arduino 190430a