Programming in Arduino Materials:Arduino Board Casperelectronics Pre Pres. Notes Photos from workshop?

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.
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.
How to use Arduino By: Andrew Hoffmaster.
Embedded Sumo 1T4 – 1T5 UTRA.
Re-programming the Simon Says with Arduino Linz Craig, Brian Huang.
Digital & Analog Inputs. Review Fundamental parts of an Arduino program are … Setting output types using pinMode. Declaring variables Can write a digital.
Introduction to Arduino Programming January MER-421:Mechatronic System Design.
ELCT 201 week 13 Analog ON/OFF control system conversion to Digital ON/OFF control system.
Intro to Programming and Microcontrollers. Activity Group into pairs and sit back-to-back. Pick one person who is going to draw. The other person will.
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.
Analog and Digital Measurements living with the lab 14 digital input / output pins 6 analog input pins © 2011 LWTL faculty team.
Embedded Programming and Robotics Lesson 2 C Programming Refresher C Programming1.
ARDUINO PROGRAMMING Working with the Arduino microcontroller.
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
Arduino John Marcoux Christopher Lesch Thomas Dodge Unless otherwise noted, all information and pictures came from:
chipKit Sense Switch & Control LED
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
Good LED Circuit 5V0 GND. What Voltage Does Meter See? Answer: 5 V.
ARDUINO 1. Basics  Comments  /* * Blink * * The basic Arduino example. Turns on an LED on for one second, * then off for one second, and so on... We.
1 - Remove LED from 13 and GND - Bring out your breadboard from HW#4 Arduino Overview:
Microcontrollers, Microcomputers, and Microprocessors
Arduino libraries Datatekniker Udvidet hardware/software.
INTERNET OF EVERYTHING SDU 2016 Week 4. Simple Digital and Analog Inputs  The Arduino’s ability to sense digital and analog inputs allows it to respond.
Microcontroller basics Embedded systems for mortals.
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.
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!”
Arduino + Bluetooth TYWu. Connection Arduino + Bluetooth Module.
:Blink Blink: Er. Sahil Khanna
Arduino “Getting Started” Instructor : Dr Matthew Miss Khin Yi Kyaw
ME 120: Arduino Programming Arduino Programming Part 1 ME 120 Mechanical and Materials Engineering Portland State University
[LAB 2] Cloud9 IDE  Cloud9 IDE introduction  Example and Exercise.
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.
Getting Started: Building & Programming
Microcontroller basics
More on LED’s with Arduino
Val Manes Department of Math & Computer Science
Microcontroller basics
Arduino Programming Part II
UTA010 : Engineering Design – II
Welcome to Arduino A Microcontroller.
Get Your Project Started with Arduino
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.
Arduino.
Въведение в Arduino.
IoT Programming the Particle Photon.
Arduino 101 Credit(s):
Working with Arduino: Lesson #1: Getting Acquainted with the Kit
Welcome to Digital Electronics using the Arduino Board
Programming 2: The Arduino IDE & First Sketches
CTY SAR FCPS Shawn Lupoli, Elliot Tan
Aeroponic Engineering and Vertical Farming
Lab #1: Getting Started.
Arduino Uno circuit basics
Setting up a basic program with Arduino
SAURABH GINGADE.
UNIT 1 First programs.
Arduino程式範例.
Introduction to Arduino IDE and Software
Presentation transcript:

Programming in Arduino Materials:Arduino Board Casperelectronics Pre Pres. Notes Photos from workshop?

Arduino.cc has the IDE programming software for free downloadArduino.cc

Arduino Sketch Arduino files are called “sketches”. Arduino sketches must be compiled in the IDE before being downloaded to the Arduino board.

Program Structure Two required functions in an Arduino sketch, setup() and loop(). setup() The function is called when your program starts. Use it to initialize your variables, pin modes, start using libraries, etc. The setup function will only run once, after each powerup or reset of the Arduino board. Loop() After creating a setup() function, which initializes and sets the initial values, the loop() function does precisely what its name suggests, and loops consecutively, allowing your program to change and respond. Use it to actively control the Arduino board.

What does “void” mean The void keyword is used only in function declarations. It indicates that the function is expected to return no information to the function from which it was called.

Libraries Extend the capabilities of Arduino IDE Offer simpiler ways of controlling hardware they are written for. Advanced. will talk about later.

Variables Let you store a value. Must declare variables and tell computer what kind of value to expect. Int- number between -32,768 to 32,767 Byte char- type character and more……

Int variable int- an integer is a whole number (1,2,3,25) are your primary datatype for number storage, and store a 2 byte value (take 2 bytes of memory). This yields a range of -32,768 to 32,767 example: int ledpin = 13; // sets the variable named ledpin to 13

Char variable char- A data type that takes up 1 byte of memory that stores a character value. Both of these are equivalent and refer to the letter A: char myChar = 'A'; char myChar = 65; in ASCII

Byte variable Byte- an integer between 0 and 255 (byte uses less memory, only 1 byte) Made up of 8 bits. Example in binary: ,

Binary Numbering (how computers count) If computers only know 1 and 0 how do they form complex operations? = = = = 4

Programming- Functions Segmenting code into functions allows a programmer to create modular pieces of code that perform a defined task and then return to the area of code from which the function was "called". Existing Functions- commands Arduino automatically understands Custom Functions - The typical case for creating a function is when one needs to perform the same action multiple times in a program.

Example Functions: pinMode(), digitalWrite(), and delay() The pinMode() function configures a pin as either an input or an output. pinMode(ledPin, OUTPUT); // sets the digital pin as output The digitalWrite() function outputs a value HIGH or LOW on a pin. For example, the line: digitalWrite(ledPin, HIGH); //sets pin high The delay() causes the Arduino to wait for the specified number of milliseconds before continuing on to the next line. There are 1000 milliseconds in a second, so the line: delay(1000); // creates a delay of one second.

Pseudocode: Blink an Led English: I want an led to blink, on for a second and off for a second forever. Pseudocode: Turn led on wait Turn led off Loop again

Pseudocode Translation void loop() // run over and over again { digitalWrite(ledPin, HIGH); // sets the LED on delay(1000); // waits for a second digitalWrite(ledPin, LOW); // sets the LED off delay(1000); // waits for a second }

Blink an Led (w/o comments) int ledPin = 13; void setup() { pinMode(ledPin, OUTPUT); } void loop() { digitalWrite(ledPin, HIGH); delay(1000); digitalWrite(ledPin, LOW); delay(1000); }

Blink an Led int ledPin = 13; // LED connected to digital pin 13 void setup() // run once, when the sketch starts { pinMode(ledPin, OUTPUT); // sets the digital pin as output } void loop() // run over and over again { digitalWrite(ledPin, HIGH); // sets the LED on delay(1000); // waits for a second digitalWrite(ledPin, LOW); // sets the LED off delay(1000); // waits for a second }

Demo Programming board

HW : Bring in a video or webpage link that is related to Physical Computing that you think is interesting and be prepared to talk about it in class.