ME 120: Arduino Programming Arduino Programming Part 1 ME 120 Mechanical and Materials Engineering Portland State University

Slides:



Advertisements
Similar presentations
Making Electronic Fashion Welcome Pink Team!. Etiquette Creative Girls Technology Arts.
Advertisements

EMS1EP Lecture 6 Digital Inputs
EMS1EP Lecture 4 Intro to Programming Dr. Robert Ross.
Electrical team Arduino tutorial I BY: JOSHUA arduini
Lab7: Introduction to Arduino
Anurag Dwivedi & Rudra Pratap Suman.  Open Source electronic prototyping platform based on flexible easy to use hardware and software.
Embedded Sumo 1T4 – 1T5 UTRA.
ELCT 201 week 13 Analog ON/OFF control system conversion to Digital ON/OFF control system.
Living with the Lab Using servos with an Arduino EAS 199A Fall 2011.
Living with the lab Introduction to Arduino Programming arduino.cc Gerald Recktenwald Portland State University
IR Object Detection living with the lab IR light from LED IR light reflected off object IR LED IR receiver Infrared (IR) light leaving an LED reflects.
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.
Introduction.
Introduction to Arduino Prepared by R. Lamond.  “Arduino is an open-source electronics prototyping platform based on flexible, easy- to-use hardware.
Basic Circuits – Lab 2 Arduino and Sensors Xmedia Spring 2011.
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.
Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)
Ballooning Bundle. What is a Microcontroller? Small computer with a processor core, memory and programmable input/output Continuously repeats software.
Microcontroller Hands-on Workshop #3 Ahmad Manshad New Mexico State University Institute of Electrical and Electronics Engineers November 7, 2009.
Microprocessors Tutorial 1: Arduino Basics
Programming Hexors on Arduino Uno. Arduino Uno Arduino is an open-source electronics platform based on easy- to-use hardware and software. It's intended.
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
Arduino 101 Instructors: Ted Markson / Jim Sweeney.
Cascade switching of an LED EAS 199B Winter 2013.
Franz Duran INTRODUCTION TO A RDUINO PROGRAMMING & INTERFACING Engr. Franz Duran, MEP-ECE RapidSignal Electronics.
Microprocessors Tutorial 1: Arduino Basics
1 - Remove LED from 13 and GND - Bring out your breadboard from HW#4 Arduino Overview:
Microcontroller Hands-on Workshop #2 Ahmad Manshad New Mexico State University Institute of Electrical and Electronics Engineers October 31, 2009.
Microcontrollers, Microcomputers, and Microprocessors
Arduino libraries Datatekniker Udvidet hardware/software.
Photoresistor resistance changes dramatically with light level living with the lab Using Photoresistors with an Arduino © 2011 LWTL faculty team.
Microcontroller basics Embedded systems for mortals.
ME 120: User-defined functions: average analog input reading Arduino Programming – Part 5: User-defined functions ME 120 Mechanical and Materials Engineering.
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
Robotics Grant Agreement No LLP UK-LEONARDO-LMP Project acronym: CLEM Project title: Cloud services for E-Learning in Mechatronics Technology.
Programming in Arduino Materials:Arduino Board Casperelectronics Pre Pres. Notes Photos from workshop?
Bdps 2 Lecture 2. Circuits and Ohm's Law For resistive circuits.
Introduction to Arduino A very basic intro to Arduino, the IDE and the Servos class.
Arduino Training For You! Learn Programming at Your Own Pace! Chapter 1 A course developed from the text book: “Introduction to Arduino A Piece of Cake!”
:Blink Blink: Er. Sahil Khanna
Arduino Programming Part 6: LCD Panel Output ME 121 Portland State University.
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 - Introduction
Arduino.
Microcontroller basics
Dr. Kyung Eun Park Summer 2017
Val Manes Department of Math & Computer Science
Microcontroller basics
Introduction to the Arduino
Cascade switching of an LED
Get Your Project Started with Arduino
UCD ElecSoc Robotics Club 2017/2018
Arduino.
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.
FeMaidens Programming
Arduino 101 Credit(s):
Working with Arduino: Lesson #1: Getting Acquainted with the Kit
Topics: Programming Constructs: loops & conditionals Digital Input
Programming 2: The Arduino IDE & First Sketches
Lab #1: Getting Started.
Arduino Uno circuit basics
Setting up a basic program with Arduino
Arduino程式範例.
Presentation transcript:

ME 120: Arduino Programming Arduino Programming Part 1 ME 120 Mechanical and Materials Engineering Portland State University

ME 120: Arduino Programming Overview Arduino Environment Basic code components ❖ Two required functions: startup() and loop() ❖ Variables ❖ Calling built-in functions 2

ME 120: Arduino Programming References These notes borrow from ❖ Arduino web site ‣ ‣ ❖ Adafruit tutorial #1 and 2 ‣ ❖ Leah Buechley’s Introduction to Arduino ‣ 3

ME 120: Arduino Programming Arduino Web Site References Overview of the development environment ❖ Language reference ❖ Code tutorials ❖ 4

ME 120: Arduino Programming Basic Process Design the circuit: ❖ What are electrical requirements of the sensors or actuators? ❖ Identify analog inputs (sensors) ❖ Identify digital inputs & outputs (buttons, LEDs, relays) Write the code ❖ Build incrementally ‣ Get the simplest piece to work first ‣ Add complexity and test at each stage ‣ Save and Backup frequently ❖ Use variables, not constants ❖ Comment liberally 5

ME 120: Arduino Programming Writing and Downloading Code 6

ME 120: Arduino Programming Running Code While Tethered 7

ME 120: Arduino Programming Running Code Stand-Alone 8

ME 120: Arduino Programming Open the example sketch, blink.ino 9

ME 120: Arduino Programming Load “Blink” from the built-in examples 10

ME 120: Arduino Programming Load “Blink” from the built-in examples 11

ME 120: Arduino Programming Arduino IDE 12 IDE = en/Guide/Environment Integrated Developmen t Environment

ME 120: Arduino Programming Common Code Structure 13

ME 120: Arduino Programming Code Structure: Header 14 Header provides information. Can also contain code

ME 120: Arduino Programming Code Structure: setup function 15 setup function is executed only once at the start

ME 120: Arduino Programming Code Structure: loop function 16 loop function is repeated indefinitely

ME 120: Arduino Programming Details of the Blink Code 17

ME 120: Arduino Programming Code 18 pinMode(led, Output) prepare pin number “led” for outputs of voltage “led” is a variable int led = 13; creates a variable named “led” and stores 13 in that variable

ME 120: Arduino Programming Code 19 digitalWrite(led, HIGH) Sets pin “led” to a value that means the voltage is “on” delay(1000); tells microcontroller to do nothing for 1000 ms = 1 s

ME 120: Arduino Programming Code 20 digitalWrite(led, LOW) Sets pin “led” to a value that means the voltage is “off” delay(1000); tells microcontroller to do nothing for 1000 ms = 1 s