Arduino Part 1 Topics: Microcontrollers Programming Basics

Slides:



Advertisements
Similar presentations
Lab7: Introduction to Arduino
Advertisements

Anurag Dwivedi & Rudra Pratap Suman.  Open Source electronic prototyping platform based on flexible easy to use hardware and software.
How to use Arduino By: Andrew Hoffmaster.
Embedded Sumo 1T4 – 1T5 UTRA.
Intro to the Arduino Topics: The Arduino Digital IO Analog IO Serial Communication.
1 Arduino Board: Arduino UNO Arduino Programing Environment: Arduino 0022
 Main Components:  Sensors  Micro controller  Motor drivers  Chasis.
Introduction to Arduino Prepared by R. Lamond.  “Arduino is an open-source electronics prototyping platform based on flexible, easy- to-use hardware.
Embedded Programming and Robotics
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.
Arduino Part 2 Topics: Serial Communication Programming Constructs: functions, loops and conditionals Digital Input.
Colorado Space Grant Consortium Gateway To Space ASEN 1400 / ASTR 2500 Class #12 Gateway To Space ASEN 1400 / ASTR 2500 Class #12 T-58.
DPNM Lab., POSTECH 1/25 CS490K - Internet of Things (IoT) Jonghwan Hyun DPNM Lab. Department of Computer Science and Engineering, POSTECH
Intro to the Arduino Topics: The Arduino Digital IO
Arduino. What is it? A open-source software suite and single-board microcontroller. Allows easy and affordable prototyping of microcontroller applications.
Microcontrollers, Microcomputers, and Microprocessors
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.
Harpeth Hall Jan 2016 Introduction to Arduino Prepared for Harpeth Hall Winterim January 2016.
Having fun with code, using Arduino in a middle school CS classroom
Arduino.
Arduino Part 1 Topics: Microcontrollers
Embedded Systems Intro to the Arduino
Getting Started: Building & Programming
Michael Rahaim, PhD Candidate Multimedia Communications Lab
Application of Programming: Scratch & Arduino
Assist. Prof. Rassim Suliyev - SDU 2017
Microcontroller basics
Val Manes Department of Math & Computer Science
Microcontroller basics
Wireless Cue Light Project
Intro to the Arduino Created by
Arduino & its hardware interfacing
Arduino Programming Part II
UTA010 : Engineering Design – II
An Arduino Workshop A Microcontroller.
Welcome to Arduino A Microcontroller.
Get Your Project Started with Arduino
UCD ElecSoc Robotics Club 2017/2018
INC 161 , CPE 100 Computer Programming
Lecture 2-2: Arduino Programming
Introduction to Arduino Microcontrollers
Topics: Analog/Digital Read Relay control 7 segment control Buzzer
Roller Coaster Design Project
ARDUINO     What is an Arduino? Features 14 Digital I/O pins 6 Analogue inputs 6 PWM pins USB serial 16MHz Clock speed 32KB Flash memory 2KB SRAM.
What is an Arduino ? Open Source electronic prototyping platform based on flexible easy to use hardware and software.
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 : Introduction & Programming
Intro to the Arduino by Someet Singh
Programming 2: The Arduino IDE & First Sketches
Aeroponic Engineering and Vertical Farming
Arduino Leonardo Setup
Introduction to Arduino
Lab #1: Getting Started.
Arduino Uno circuit basics
Arduino Board.
Arduino म्हणजे काय?.
Introduction to Arduinos
Model Blimp Design Competition Programming Workshop by Youth College (International) / VTC May
Introduction to arduino
Arduino程式範例.
Introduction to Arduino IDE and Software
Presented By,  Mamata Yadav (BE Elex & Comm.) Vice R&D Coordinator(HW), PCRT  Payal Shah (BE Elex & Comm.)  Ananta Das (BE Elex & Comm.) R&D Team,PCRT.
Interrupts.
Presentation transcript:

Arduino Part 1 Topics: Microcontrollers Programming Basics Digital Output Serial Communication

Workshop Overview Introduction to microcontroller and Arduino The Hardware: Arduino UNO The Software: The Arduino IDE The Language : Arduino-C language Hands-on Project 1: Talking to arduino Hands-on Project 2: LED blinking Hands-on Project 3: Serial Controlled LED

What is an Arduino? An open-source platform used for building electronics projects A complete controller with CPU, RAM, Flash memory, and input/output pins, all on a single chip

The Hardware : Arduino UNO USB(Power) Barrel jack(Power) Ground 5V supply 3.3V supply Analog input Digital input PWM output Analog Ref input Reset Button Power indicator RX, TX indicator Main IC Voltage Regulator Built in test LED connected to pin13

Getting Started Check out: http://arduino.cc/en/Guide/HomePage Download & install the Arduino environment (IDE) Connect the board to your computer via the USB cable If needed, install the drivers Launch the Arduino IDE Select your board Select your serial port

The Software : Arduino IDE 3 4 1 5 Verify button Upload button New file button Open file button Safe file button Program area Status bar Notification area 2 } 6 } 7 } 8

Select Serial Port and Board

Opening sample program

Our First program/sketch What’s Next?? Press verify button to check for errors Press upload button to load the program into the arduino Observe the on-board LED

Status Messages todbot.com/blog/bionicarduino

The Language : Arduino - C Basic program structure : setup( ): A function present in every Arduino. Run once before the loop( ) function. Often used to set pinmode to input or output. loop( ): A function present in every single Arduino sketch. This code happens over and over again. The loop( ) is where (almost) everything happens. The one exception to this is setup( ) and variable declaration.

The Language : Arduino - C The setup: To assign a port to read signal use: pinMode(pinNumber,INPUT); To assign a port to send signal use: pinMode(pinNumber,OUTPUT) To initialize serial communication at 9600 bits per second : Serial.begin(9600);

The Language : Arduino - C Digital I/O: • Digital Input/Output uses the Digital pins, but Analog In pins can be used as Digital • To receive a Digital signal use: digitalRead(pinNumber); • To send a Digital signal use: digitalWrite(pinNumber, value); • Digital Input and Output are always either HIGH or LOW Analog I/O: • Analog Input uses the Analog In pins, Analog Output uses the PWM pins • To receive an Analog signal use: analogRead(pinNumber); • To send a PWM signal use: analogWrite(pinNumber, value); • Analog Input values range from 0 to 1023 (1024 values because it uses 10 bits, 210) • PWM Output values range from 0 to 255 (256 values because it uses 8 bits, 28).

The Language : Arduino - C Time/delay functions: delay(ms) : eg. To wait for 1sec, use delay(1000) delayMicroseconds(us) : eg. To wait for 0.001sec, use delayMicroseconds(1000) millis() : once this function is called, it will update the variable every miliseconds micros() : once this function is called, it will update the variable every microseconds More commands: arduino.cc/en/Reference/HomePage

The Language : Arduino - C Serial communication functions: Used for communication between the Arduino board and a computer or other devices. Serial.begin(9600) : to opens serial port, sets data rate to 9600 bps Serial.print() : Prints data to the serial port as human-readable ASCII text. Serial.println() : Prints data at the following line Serial.available() : Get the number of bytes (characters) available for reading from the serial port. Serial.read() : read the incoming data byte Serial.write() : Writes binary data to the serial port. This data is sent as a byte or series of bytes; to view serial output, click on the serial monitor at the arduino IDE: Serial monitor More commands: arduino.cc/en/Reference/HomePage

Hands-on Project 1: Talking to arduino 2 The hardware setup: Write the code/sketch: Int Data = 0;    void setup() {         Serial.begin(9600);      } void loop() {         if (Serial.available() > 0) {       Data = Serial.read();                  Serial.print("you have entered: "); Serial.write(Data); Serial.println();          } }

Hands-on Project 1: Talking to arduino 3 4 Load the program into arduino Open serial monitor and observe the output Press verify button to check for errors Press upload button to load the program into the arduino Serial monitor

Hands-on Project 2: LED Blinking 1 2 The hardware setup: Write the code/sketch: void setup() { serial.begin(9600); pinMode(13, OUTPUT); } void loop() { digitalWrite(13, HIGH); serial.println(“ LED ON”); delay(1000); digitalWrite(13, LOW); serial.println(“ LED OFF”);

Hands-on Project 2 : LED Blinking 3 4 Load the program into arduino Observe the output on the board and open serial monitor Press verify button to check for errors Press upload button to load the program into the arduino Serial monitor

Hands-on Project 3: Serial controlled LED 1 2 The code/sketch: The hardware setup: void setup() { Serial.begin(9600); pinMode(13, OUTPUT); } void loop() { if (Serial.available() > 0) { int inByte = Serial.read(); switch (inByte) { case 'a': digitalWrite(13, HIGH); break; case 'b': digitalWrite(13, LOW);

Hands-on Project 3 : Serial controlled LED 4 Press the letter ‘a’ or ‘b’ from your keyboard and observe your led Load the program into arduino Press verify button to check for errors Press upload button to load the program into the arduino

References www.arduino.cc www.ladyada.net/learn/arduino www.EarthshineElectronics.com