ProtoSnap Introduction to Arduino Casey Haskell, Pete Lewis, David Stillman, Jim Lindblom, Pete Dokter, Lindsay Levkoff, Trevor Zylstra.

Slides:



Advertisements
Similar presentations
EMS1EP Lecture 4 Intro to Programming Dr. Robert Ross.
Advertisements

EMS1EP Lecture 8 Pulse Width Modulation (PWM)
ARDUINO CLUB What we’re really doing. BASICS The setup() and loop() functions.
Lab7: Introduction to Arduino
ARDUINO FRAMEWORK.
Intermediate Electronics and Lilypad Where Electronics Meet Textiles Workshop with Lynne Bruning and Troy Robert Nachtigall Sponsored by Spark Fun and.
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.
Intro to Arduino with LilyPad Make a MakerSpace, Artisan’s Asylum Linz Craig, Chris Taylor, Mike Hord & Joel Bartlett.
Introduction.
Embedded Programming and Robotics Lesson 2 C Programming Refresher C Programming1.
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.
Embedded Programming and Robotics
ARDUINO PROGRAMMING Working with the Arduino microcontroller.
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
Arduino Part 2 Topics: Serial Communication Programming Constructs: functions, loops and conditionals Digital Input.
Intro to Arduino Zero to Virtual Prototyping in Seven Hours
Microprocessors Tutorial 1: Arduino Basics
Introduction to the Arduino
ATLAS 2013 Super Fast Intro to Arduino and Processing Materials by Lindsay Craig, David Stillman and Ben Leduc-Mills.
Tweaking Your Simon Adding a photoresistor and changing code Instruction by Pete Lewis and Linz Craig.
L ILY P AD T RAINING C ENTENNIAL E LEMENTARY 2012 Material by Linz Craig Revision by Sarah Bloms Additional images by Modkit & Adam Meyer.
Tweaking Your Simon Adding a photoresistor and changing code Instruction by Pete Lewis.
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
Code The Arduino Environment.
Microprocessors Tutorial 1: Arduino Basics
Programming, Serial and Virtual Prototyping. Code if ( You like semicolons ) { Stay here for intro to Arduino code } else { Join the MODKit group for.
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:
SAMI MAKERSPACE MAKE: AN ELECTRONICS WORKSHOP. ARDUINO BASICS Credit to: Sparkfun and Linz Craig, Nick Poole, Prashanta Aryal, Theo Simpson, Tai Johnson,
Microcontroller Hands-on Workshop #2 Ahmad Manshad New Mexico State University Institute of Electrical and Electronics Engineers October 31, 2009.
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.
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?
Introduction to Arduino A very basic intro to Arduino, the IDE and the Servos class.
Intro to Arduino Basic Arduino John Wolf (WolfDenElectronics.com)
Arduino “Getting Started” Instructor : Dr Matthew Miss Khin Yi Kyaw
Pulse Width Modulation Instructor Dr Matthew Khi Yi Kyaw.
1 Microcontrollers. 2 Programmers work in the virtual world Machinery works in the physical world Microcontrollers connect the virtual and physical world.
Harpeth Hall Jan 2016 Introduction to Arduino Prepared for Harpeth Hall Winterim January 2016.
Arduino - Introduction
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
Val Manes Department of Math & Computer Science
Arduino & its hardware interfacing
European Robotic LABoratory
UCD ElecSoc Robotics Club 2017/2018
Arduino Part 1 Topics: Microcontrollers Programming Basics
INC 161 , CPE 100 Computer Programming
Lecture 2-2: Arduino Programming
Arduino - Introduction
Analog Input through POT
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.
IoT Programming the Particle Photon.
Programming, Serial and Virtual Prototyping
Arduino 101 Credit(s):
1 Code
Arduino : Introduction & Programming
Programming 2: The Arduino IDE & First Sketches
Arduino Uno circuit basics
Introduction to Arduinos
Arduino程式範例.
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.
Presentation transcript:

ProtoSnap Introduction to Arduino Casey Haskell, Pete Lewis, David Stillman, Jim Lindblom, Pete Dokter, Lindsay Levkoff, Trevor Zylstra

Overview of Class History of Arduino/SFE What is the Protosnap?: Concept, design, hardware Intro to Coding: Arduino software Example Sketches: Digital Output, Digital Input RGB LEDs Analog Input, Analog Output

SparkFun Electronics Sharing Ingenuity

Arduino Board “Strong Friend” Created in Ivrea, Italy in 2005 by Massimo Banzi & David Cuartielles Open Source Hardware Atmel Processor Coding is accessible (C++, Processing, ModKit and MiniBloq) Team Arduino: (Left to right) David Cuartielles, Massimo Banzi & Gianluca Martino

Numbers on the tabs indicate how they are pre- wired to the arduino mini.

Arduino Mini

The Arduino Environment

The Environment

Parts of the Sketch

Board Type

Serial Port / COM Port

Digital Output To Output a Digital signal (On or Off) use this code: digitalWrite ( pinNumber, value ); Where value is HIGH or LOW Where pinNumber is the pin you want effect.

Now let's upload “Blink.pde”

Declaring Variables Boolean: boolean variableName; Integer: int variableName; Character: char variableName; String: stringName [ ];

Assigning Variables Boolean: variableName = true; or variableName = false; Integer: variableName = 32767; or variableName = ; Character: variableName = ‘A’; or stringName = “SparkFun”;

Now let's add variables to “Blink.pde” (and for fun, let's try changing the delay time)

Digital Input Useful when reading a button. *The protosnap has a button pre-wired to pin 7. Add this to your setup:pinMode ( 7, INPUT ); Use this in your loop: digitalRead ( 7 ); Digital Input values are HIGH or LOW

Button Schematic

Internal Pullup Resistors Add this to your setup: digitalWrite ( 7, HIGH ); This means... your button will read HIGH when it is not pushed and LOW when it is pushed

If Statements if ( this is true ) { do this; }

If if ( this is true ) { do this; }

Conditional if ( this is true ) { do this; }

Action if ( this is true ) { do this; }

Else else { do this; }

Now let's upload “Button.pde”

RGB LEDs are different... To turn these LEDs on... digitalWrite(3, LOW);

Analog Input Useful to read a sensor that is not simply ON/OFF. (i.e. something like brightness, direction or speed) *The protosnap has a light sensor wired to Pin A0. Use this in your loop: analogRead ( A0 ); Analog Input varies from 0 to 1023 on an Arduino

Before we use analogRead(), let's learn about Serial Communication. This will be very useful to understand analogRead(); It will allow us to stream the values from the light sensor and watch the data change in real time.

Serial in Setup

Serial Communication: Serial Setup void setup ( ) { pinMode ( 5, OUTPUT ); pinMode ( 6, OUTPUT ); pinMode ( 7, OUTPUT ); Serial.begin ( 9600 ) ; } In this case the number 9600 is the baudrate at which the computer and Arduino communicate

Serial Monitor

Serial Communication: Sending a Message void loop ( ) { //read the value from the sensor: sensorValue = analogRead (sensorPin); Serial.println(sensorValue); if(sensorValue < 90){ digitalWrite(5, LOW); } //code continues after this

Serial Communication

Now let's upload “Light_data_stream.pde”

Now let's do something with the light values! Using “if statements” we can turn on different RGB LEDs when there is different amounts of light in the room. Let's upload AnalogInput_Multi_Threshold.pde

Analog Output Output is always Digital but… To output a signal that pretends to be Analog use this code: analogWrite ( pinNumber, value ); Where value is a number Where pinNumber is the pin you want to effect.

Analog Output Output is always Digital Using a Digital signal that pretends to be an Analog signal is called Pulse Width Modulation Use Pulse Width Modulation, or P.W.M., for anything that requires a signal between HIGH and LOW * like setting an LEDs brightness P.W.M. is available on Arduino pins # 3, 5, 6, 9, 10, and 11

Analog Output Output is always Digital, even when it’s P.W.M. For P.W.M. the Arduino pin turns on then off very fast P.W.M. 25%P.W.M. 75% P.W.M. Signal rising

Now let's upload “Analog_Blink.pde”

Basic Repetition for (int count = 0; count<10; count++) { //for action code goes here //this could be anything }

Basic Repetition for (int count = 0; count<10; count++) { //for action code goes here }

Basic Repetition for (int count = 0; count<10; count++) { //for action code goes here }

Basic Repetition for (int count = 0; count<10; count++) { //for action code goes here }

Basic Repetition for (int count = 0; count<10; count++) { //for action code goes here }

Basic Repetition for (int count = 0; count<10; count++) { //for action code goes here }

Basic Repetition for (int count = 0; count<10; count++) { //for action code goes here }

Now Let's try “Fading” an LED You can find it here...

Note, we need to change the variable “ledPin” to one of the RGB pins (5,6 or 3).

Oh, Snap! Personal Projects Dave’s Alarm System Pete’s Guitar Ben’s Project

Questions?

Longbow Drive, Suite 200 Boulder, Colorado 80301