Lab 02 Arduino 數位感測訊號處理, SPI I2C 介面實驗. More Arduino Digital Signal Process

Size: px
Start display at page:

Download "Lab 02 Arduino 數位感測訊號處理, SPI I2C 介面實驗. More Arduino Digital Signal Process"

Transcription

1 Lab 02 Arduino 數位感測訊號處理, SPI I2C 介面實驗 More Arduino Digital Signal Process

2 Blink Without Delay Sometimes you need to do two things at once. For example you might want to blink an LED (or some other timesensitive function) while reading a button press or other input. In this case, you can't use delay(), or you'd stop everything else the program while the LED blinked. The program might miss the button press if it happens during the delay(). This example demonstrates how to blink the LED without using delay(). It keeps track of the last time the Arduino turned the LED on or off. Then, each time through loop(), it checks if a long enough interval has passed. If it has, it toggles the LED on or off. 2

3 Circuit Hardware Required Arduino Board LED 3

4 Code for Blink Without Delay const int ledpin = 13; // the number of the LED pin // Variables will change: int ledstate = LOW; // ledstate used to set the LED long previousmillis = 0; // will store last time LED was updated // the follow variables is a long because the time, measured in miliseconds,\ // will quickly become a bigger number than can be stored in an int. long interval = 1000; // interval at which to blink (milliseconds) void setup() { // set the digital pin as output: pinmode(ledpin, OUTPUT); 4

5 Code for Blink Without Delay void loop() { // here is where you'd put code that needs to be running all the time. // check to see if it's time to blink the LED; that is, if the // difference between the current time and last time you blinked // the LED is bigger than the interval at which you want to // blink the LED. unsigned long currentmillis = millis(); if(currentmillis - previousmillis > interval) { // save the last time you blinked the LED previousmillis = currentmillis; // if the LED is off turn it on and vice-versa: if (ledstate == LOW) ledstate = HIGH; else ledstate = LOW; // set the LED with the ledstate of the variable: digitalwrite(ledpin, ledstate); 5

6 millis() The code below uses the millis() function, a command that returns the number of milliseconds since the Arduino board started running its current program, to blink an LED. 6

7 Button Pushbuttons or switches connect two points in a circuit when you press them. This example turns on the built-in LED on pin 13 when you press the button. 7

8 Circuit Hardware Arduino Board momentary button or switch 10K ohm resistor breadboard hook-up wire 8

9 Schematic When the pushbutton is open (unpressed) there is no connection between the two legs of the pushbutton, so the pin is connected to ground (through the pull-down resistor) and we read a LOW. When the button is closed (pressed), it makes a connection between its two legs, connecting the pin to 5 volts, so that we read a HIGH. 9

10 Code for Button const int buttonpin = 2; const int ledpin = 13; // variables will change: int buttonstate = 0; void setup() { pinmode(ledpin, OUTPUT); pinmode(buttonpin, INPUT); // the number of the pushbutton pin // the number of the LED pin void loop(){ buttonstate = digitalread(buttonpin); if (buttonstate == HIGH) digitalwrite(ledpin, HIGH); else digitalwrite(ledpin, LOW); // variable for reading the pushbutton status // initialize the LED pin as an output: // initialize the pushbutton pin as an input: // read the state of the pushbutton value: // check if the pushbutton is pressed. // if it is, the buttonstate is HIGH: turn LED on: // turn LED off 10

11 Button State Change Detection (Edge Detection) Once you've got a pushbutton working, you often want to do some action based on how many times the button is pushed. To do this, you need to know when the button changes state from off to on, and count how many times this change of state happens. This is called state change detection or edge detection. 11

12 Schematic The sketch is same as pervious button example. It then compares the button's state to its state the last time through the main loop. If the current button state is different from the last button state and the current button state is high, then the button changed from off to on. The sketch then increments a button push counter. The sketch also checks the button push counter's value, and if it's an even multiple of four, it turns the LED on pin 13 ON. Otherwise, it turns it off. 12

13 Code for Button State Change Detection const int buttonpin = 2; const int ledpin = 13; // the pin that the pushbutton is attached to // the pin that the LED is attached to // Variables will change: int buttonpushcounter = 0; // counter for the number of button presses int buttonstate = 0; // current state of the button int lastbuttonstate = 0; // previous state of the button void setup() { // initialize the button pin as a input: pinmode(buttonpin, INPUT); // initialize the LED as an output: pinmode(ledpin, OUTPUT); // initialize serial communication: Serial.begin(9600); 13

14 Code for Button State Change Detection void loop() { buttonstate = digitalread(buttonpin); // read the pushbutton input pin: if (buttonstate!= lastbuttonstate) {// compare the buttonstate to its previous state if (buttonstate == HIGH) { // if the state has changed, increment the counter // if the current state is HIGH then the button wend from off to on: buttonpushcounter++; Serial.println("on"); Serial.print("number of button pushes: "); Serial.println(buttonPushCounter, DEC); else { // if the current state is LOW then the button wend from on to off: Serial.println("off"); 14

15 Code for Button State Change Detection // save the current state as the last state, //for next time through the loop lastbuttonstate = buttonstate; // turns on the LED every four button pushes by // checking the modulo of the button push counter. // the modulo function gives you the remainder of // the division of two numbers: if (buttonpushcounter % 4 == 0) { digitalwrite(ledpin, HIGH); else { digitalwrite(ledpin, LOW); 15

16 Interrupts in Arduino Interrupts can help solve timing issues which may occur within your code/hardware setup. You may have had timing issues already and just not understood what happened. On the Duemilanove, there are 2 hardware interrupts available. These are located on Digital Pins 2 and 3. 16

17 Circuit As same as the Button State Change Detection example 17

18 Standard Digital Input and Output - No Interrupts int pbin = 2; // Digital input on pin 2 int ledout = 13; // The output LED pin int state = LOW; // The input state void setup() { // Set up the digital Pin 2 to an Input and Pin 4 to an Output pinmode(pbin, INPUT); pinmode(ledout, OUTPUT); void loop() { state = digitalread(pbin); //Read the button digitalwrite(ledout, state); //write the LED state //Simulate a long running process or complex task for (int i = 0; i < 100; i++) { // do nothing but waste some time delay(30); 18

19 Making Use of Interrupts int pbin = 0; // Interrupt 0 is on DIGITAL PIN 2! int ledout = 13; // The output LED pin volatile int state = LOW; // The input state toggle void setup() { // Set up the digital pin 2 to an Interrupt and Pin 13 to an Output pinmode(ledout, OUTPUT); //Attach the interrupt to the input pin //and monitor for ANY Change attachinterrupt(pbin, statechange, CHANGE); void loop() { //Simulate a long running process or complex task for (int i = 0; i < 100; i++) { // do nothing but waste some time delay(30); void statechange() { state =!state; digitalwrite(ledout, state); 19

20 Attach Interrupt The attachinterrupt(param1, param2, param3) requires 3 parameters, these are; param1 = Which interrupt to listen for. This is the Interrupt Number not the Digital In number param2 = Which code function to call, this must be a method that takes no parameters and returns no value. param3 = Which condition to watch for. The Arduino can listen for 4 types of condition changes. These are; LOW = The input is at a LOW state RISING = The input state changes from LOW to HIGH FALLING = the input state changes from HIGH to LOW CHANGE = The input state changed from HIGH to LOW or LOW to HIGH, i.e. has changed its state 20

21 More Interrupts ReAssigning Interrupts Interrupts can be changed at any point by using the attachinterrupt() method. As soon as this is done, any previously assigned interrupt on the associated pin is removed. Starting / Stopping Interrupts The Arduino also has the ability to temporarily ignore all the interrupts. You may want to do this if you have some sensitive code that must be executed without interruption. In this case you would issue a nointerrupts() call. Once your sensitive code block has completed, interrupts can be restarted by calling interrupts(). Removing Interrupts Interrupts can also be removed by using the detachinterrupt(interrupt_number) method. 21

22 4 States of Traffic Light Schematic 22

23 4 States of Traffic Light Example int pinredled = 2; int pinyelled = 3; int pingrnled = 4; int lightstate = 0; void setup() { pinmode(pinredled, OUTPUT); /* Set the LED pins to output */ pinmode(pinyelled, OUTPUT); pinmode(pingrnled, OUTPUT); digitalwrite(pinredled, HIGH); /* Turn the RED light on void loop() { lightstate++; if (lightstate > 3) { // If the light state > 3, reset it to 0 (red). lightstate = 0; delay(2500); 23

24 4 States of Traffic Light Example /* Display correct light sequence */ if (lightstate == 0) { // Red digitalwrite(pinredled, HIGH); lightoff(pinyelled); lightoff(pingrnled); if (lightstate == 1) { // Red and Amber digitalwrite(pinredled, HIGH); digitalwrite(pinyelled, HIGH); lightoff(pingrnled); if (lightstate == 2) { // Green digitalwrite(pingrnled, HIGH); lightoff(pinyelled); lightoff(pinredled); 24

25 4 States of Traffic Light Example if (lightstate == 3) { // Amber-only digitalwrite(pinyelled, HIGH); lightoff(pinredled); lightoff(pingrnled); void lightoff(int pin) { digitalwrite(pin, LOW); 25

26 Classic Exercise one: Traffic light Combine the pushbutton example and the 4 states of traffic light example. Now the system add a digital switch and two new LEDs (for the crossing indicators). Initialise the lights (blink red LED 5 times, then turn on all three traffic lights) Show amber traffic light Show green traffic light and wait on green When the crossing button is pressed: (the hardware interrupt is necessary) Show the amber traffic light Show the red traffic light Show the green man Wait a preset amount of time to let the pedestrians cross Blink the green man light a few times Blink the amber traffic light a few times Extinguish the green man light and turn on the red man light Resume green traffic light Repeat! 26

27 Classic Exercise one: Traffic light The example video er_embedded 27

Arduino Workshop. Overview. What is an Arduino? Why Arduino? Setting up your Arduino Environment. Get an Arduino based board and usb cable

Arduino Workshop. Overview. What is an Arduino? Why Arduino? Setting up your Arduino Environment. Get an Arduino based board and usb cable Arduino Workshop Overview Arduino, The open source Microcontroller for easy prototyping and development What is an Arduino? Arduino is a tool for making computers that can sense and control more of the

More information

Arduino - DigitalReadSerial

Arduino - DigitalReadSerial arduino.cc Arduino - DigitalReadSerial 5-6 minutes Digital Read Serial This example shows you how to monitor the state of a switch by establishing serial communication between your Arduino or Genuino and

More information

MEDIS Module 2. Microcontroller based systems for controlling industrial processes. Chapter 4: Timer and interrupts. M. Seyfarth, Version 0.

MEDIS Module 2. Microcontroller based systems for controlling industrial processes. Chapter 4: Timer and interrupts. M. Seyfarth, Version 0. MEDIS Module 2 Microcontroller based systems for controlling industrial processes Chapter 4: Timer and interrupts M. Seyfarth, Version 0.1 Steuerungstechnik 1: Speicherprogrammierbare Steuerungstechnik

More information

IME-100 Interdisciplinary Design and Manufacturing

IME-100 Interdisciplinary Design and Manufacturing IME-100 Interdisciplinary Design and Manufacturing Introduction Arduino and Programming Topics: 1. Introduction to Microprocessors/Microcontrollers 2. Introduction to Arduino 3. Arduino Programming Basics

More information

IME-100 ECE. Lab 3. Electrical and Computer Engineering Department Kettering University. G. Tewolde, IME100-ECE,

IME-100 ECE. Lab 3. Electrical and Computer Engineering Department Kettering University. G. Tewolde, IME100-ECE, IME-100 ECE Lab 3 Electrical and Computer Engineering Department Kettering University 3-1 1. Laboratory Computers Getting Started i. Log-in with User Name: Kettering Student (no password required) ii.

More information

Sensors and Motor Control Lab

Sensors and Motor Control Lab Sensors and Motor Control Lab Individual lab report #1 October 16, 2015 Menghan Zhang TeamA Amit Agarwal Harry Golash Yihao Qian Zihao Zhang Individual progress Challenges Teamwork a) Used potentiometer

More information

EXPERIMENT2. V3 Robot Navigates Autonomously with Feelers and Infrared Sensors

EXPERIMENT2. V3 Robot Navigates Autonomously with Feelers and Infrared Sensors EXPERIMENT2 V3 Robot Navigates Autonomously with Feelers and Infrared Sensors Purpose: Install and program the feeler sensors (switches) plus the adjustable range infrared sensors to navigate autonomously

More information

Button Input: On/off state change

Button Input: On/off state change Button Input: On/off state change Living with the Lab Gerald Recktenwald Portland State University gerry@pdx.edu User input features of the fan Potentiometer for speed control Continually variable input

More information

GET YOUR DRAGONBOARD UP TO DATE

GET YOUR DRAGONBOARD UP TO DATE SAFESTOP (Instructable) A step-by-step guide on how to make this project. THINGS YOU WILL NEED DragonBoard-410c Mezzanine Shield 4 LED s 4 push bottons 4 1 Kohm resistances 4 220 ohm resistances Jumpers

More information

Arduino Programming Part 4: Flow Control

Arduino Programming Part 4: Flow Control Arduino Programming Part 4: Flow Control EAS 199B, Winter 2010 Gerald Recktenwald Portland State University gerry@me.pdx.edu Goal Make choices based on conditions in the environment Logical expressions:

More information

Interrupts Arduino, AVR, and deep dark programming secrets. What is an Interrupt?

Interrupts Arduino, AVR, and deep dark programming secrets. What is an Interrupt? Interrupts Arduino, AVR, and deep dark programming secrets What is an Interrupt? A transfer of program control that is not directed by the programmer Like a phone call in the middle of a conversation Stop

More information

TANGIBLE MEDIA & PHYSICAL COMPUTING MORE ARDUINO

TANGIBLE MEDIA & PHYSICAL COMPUTING MORE ARDUINO TANGIBLE MEDIA & PHYSICAL COMPUTING MORE ARDUINO AGENDA RECAP ALGORITHMIC APPROACHES TIMERS RECAP: LAST WEEK WE DID: ARDUINO IDE INTRO MAKE SURE BOARD AND USB PORT SELECTED UPLOAD PROCESS COVERED DATATYPES

More information

Introduction to Microcontrollers Using Arduino. PhilRobotics

Introduction to Microcontrollers Using Arduino. PhilRobotics Introduction to Microcontrollers Using Arduino PhilRobotics Objectives Know what is a microcontroller Learn the capabilities of a microcontroller Understand how microcontroller execute instructions Objectives

More information

Arduino Prof. Dr. Magdy M. Abdelhameed

Arduino Prof. Dr. Magdy M. Abdelhameed Course Code: MDP 454, Course Name:, Second Semester 2014 Arduino What is Arduino? Microcontroller Platform Okay but what s a Microcontroller? Tiny, self-contained computers in an IC Often contain peripherals

More information

Lab 01 Arduino 程式設計實驗. Essential Arduino Programming and Digital Signal Process

Lab 01 Arduino 程式設計實驗. Essential Arduino Programming and Digital Signal Process Lab 01 Arduino 程式設計實驗 Essential Arduino Programming and Digital Signal Process Arduino Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's

More information

Monitor your home remotely using the Arduino

Monitor your home remotely using the Arduino Monitor your home remotely using the Arduino WiFi Shield How to monitor some data in your home using precisely this Arduino WiFi shield. Along with the Arduino Uno board, the final system will form an

More information

Lesson 8: Digital Input, If Else

Lesson 8: Digital Input, If Else Lesson 8 Lesson 8: Digital Input, If Else Digital Input, If Else The Big Idea: This lesson adds the ability of an Arduino sketch to respond to its environment, taking different actions for different situations.

More information

The speaker connection is circled in yellow, the button connection in red and the temperature sensor in blue

The speaker connection is circled in yellow, the button connection in red and the temperature sensor in blue Connections While the board can be connected to a number of different Arduino versions I chose to use the Pro Mini as I wanted the completed unit to be fairly small. The Mini and the MP3 board run on 5

More information

DUAL PUSh BUTTON PLUG[v1.1]

DUAL PUSh BUTTON PLUG[v1.1] Product Manual DUAL PUSh BUTTON PLUG[v1.1] Updated on: 27th November 2017 Index About Elint Labz 2 Introduction 3 Specification 3 Variants 3 Supported cables: 4 Details 4 How to interface? 6 Example Codes

More information

Microcontrollers and Interfacing week 8 exercises

Microcontrollers and Interfacing week 8 exercises 2 HARDWARE DEBOUNCING Microcontrollers and Interfacing week 8 exercises 1 More digital input When using a switch for digital input we always need a pull-up resistor. For convenience, the microcontroller

More information

// The REAL DEAL - Running Code. int led22 = 22; int led23 = 23; int led24 = 24; int led25 = 25; int led27 = 27; int led29 = 29; int led31 = 31;

// The REAL DEAL - Running Code. int led22 = 22; int led23 = 23; int led24 = 24; int led25 = 25; int led27 = 27; int led29 = 29; int led31 = 31; /* // The REAL DEAL - Running Code */ int led22 = 22; int led23 = 23; int led24 = 24; int led25 = 25; int led27 = 27; int led29 = 29; int led31 = 31; int led33 = 33; int led35 = 35; int led36 = 36; int

More information

Concurrency in embedded systems Practical approach

Concurrency in embedded systems Practical approach Concurrency in embedded systems Practical approach by Łukasz Pobereżnik Agenda 1. Introduction to concurrency problems 2. Concurrency programming models for microcontrollers a. Pros and cons b. Useful

More information

ENGR 40M Project 3c: Switch debouncing

ENGR 40M Project 3c: Switch debouncing ENGR 40M Project 3c: Switch debouncing For due dates, see the overview handout 1 Introduction This week, you will build on the previous two labs and program the Arduino to respond to an input from the

More information

To enter AT Command mode using an Arduino Uno wired to a HC-05 Bluetooth Module one must first familiarized with the physical Bluetooth Module.

To enter AT Command mode using an Arduino Uno wired to a HC-05 Bluetooth Module one must first familiarized with the physical Bluetooth Module. Configuring Bluetooth HC-05 in AT mode with Arduino Uno The HC-05 module is an easy to use Bluetooth SPP (Serial Port Protocol) module, designed for transparent wireless serial connection setup [1]. In

More information

PDF of this portion of workshop notes:

PDF of this portion of workshop notes: PDF of this portion of workshop notes: http://goo.gl/jfpeym Teaching Engineering Design with Student-Owned Digital and Analog Lab Equipment John B. Schneider Washington State University June 15, 2015 Overview

More information

Arduino Course. Technology Will Save Us - Tim Brooke 10th August Friday, 9 August 13

Arduino Course. Technology Will Save Us - Tim Brooke 10th August Friday, 9 August 13 Arduino Course Technology Will Save Us - Tim Brooke 10th August 2013 Arduino Projects http://www.instructables.com/id/20-unbelievable-arduino-projects/ Blink /* Blink Turns on an LED on for one second,

More information

Project 24 LCD Temperature Display

Project 24 LCD Temperature Display Project 24 LCD Temperature Display This project is a simple demonstration of using an LCD to present useful information to the user in this case, the temperature from an analog temperature sensor. You

More information

AT42QT1010 Capacitive Touch Breakout Hookup Guide

AT42QT1010 Capacitive Touch Breakout Hookup Guide Page 1 of 7 AT42QT1010 Capacitive Touch Breakout Hookup Guide Introduction If you need to add user input without using a button, then a capacitive touch interface might be the answer. The AT42QT1010 Capacitive

More information

IR Breakbeam Sensors. Created by lady ada. Last updated on :32:59 PM UTC

IR Breakbeam Sensors. Created by lady ada. Last updated on :32:59 PM UTC IR Breakbeam Sensors Created by lady ada Last updated on 2017-12-08 10:32:59 PM UTC Guide Contents Guide Contents Overview Arduino CircuitPython 2 3 5 8 Adafruit Industries https://learn.adafruit.com/ir-breakbeam-sensors

More information

Arduino 07 ARDUINO WORKSHOP 2007

Arduino 07 ARDUINO WORKSHOP 2007 ARDUINO WORKSHOP 2007 PRESENTATION WHO ARE WE? Markus Appelbäck Interaction Design program at Malmö University Mobile networks and services Mecatronics lab at K3, Malmö University Developer, Arduino community

More information

Adapted from a lab originally written by Simon Hastings and Bill Ashmanskas

Adapted from a lab originally written by Simon Hastings and Bill Ashmanskas Physics 364 Arduino Lab 1 Adapted from a lab originally written by Simon Hastings and Bill Ashmanskas Vithayathil/Kroll Introduction Last revised: 2014-11-12 This lab introduces you to an electronic development

More information

More Arduino Programming

More Arduino Programming Introductory Medical Device Prototyping Arduino Part 2, http://saliterman.umn.edu/ Department of Biomedical Engineering, University of Minnesota More Arduino Programming Digital I/O (Read/Write) Analog

More information

Arduino Part 2. Introductory Medical Device Prototyping

Arduino Part 2. Introductory Medical Device Prototyping Introductory Medical Device Prototyping Arduino Part 2, http://saliterman.umn.edu/ Department of Biomedical Engineering, University of Minnesota More Arduino Programming Digital I/O (Read/Write) Analog

More information

micro:bit Lesson 2. Controlling LEDs on Breadboard

micro:bit Lesson 2. Controlling LEDs on Breadboard micro:bit Lesson 2. Controlling LEDs on Breadboard Created by Simon Monk Last updated on 2018-03-09 02:39:14 PM UTC Guide Contents Guide Contents Overview Parts BBC micro:bit Half-size breadboard Small

More information

AT42QT101X Capacitive Touch Breakout Hookup Guide

AT42QT101X Capacitive Touch Breakout Hookup Guide Page 1 of 10 AT42QT101X Capacitive Touch Breakout Hookup Guide Introduction If you need to add user input without using a button, then a capacitive touch interface might be the answer. The AT42QT1010 and

More information

Rotary Encoder Basics

Rotary Encoder Basics Rotary Encoder Basics A rotary encoder has a fixed number of positions per revolution. These positions are easily felt as small clicks you turn the encoder. The Keyes module that I have has thirty of these

More information

Thumb Joystick Retail. Tools and parts you'll need. Things you'll want to know. How does it work? Skill Level: Beginner. by MikeGrusin March 22, 2011

Thumb Joystick Retail. Tools and parts you'll need. Things you'll want to know. How does it work? Skill Level: Beginner. by MikeGrusin March 22, 2011 Thumb Joystick Retail Skill Level: Beginner by MikeGrusin March 22, 2011 Thank you for purchasing our Thumb Joystick! Whether you're blasting aliens or driving a robot, you'll find it a very useful addition

More information

Arduino Uno Microcontroller Overview

Arduino Uno Microcontroller Overview Innovation Fellows Program Arduino Uno Microcontroller Overview, http://saliterman.umn.edu/ Department of Biomedical Engineering, University of Minnesota Arduino Uno Power & Interface Reset Button USB

More information

Introduction to Arduino Diagrams & Code Brown County Library

Introduction to Arduino Diagrams & Code Brown County Library Introduction to Arduino Diagrams & Code Project 01: Blinking LED Components needed: Arduino Uno board LED Put long lead into pin 13 // Project 01: Blinking LED int LED = 13; // LED connected to digital

More information

Introduction to Arduino Diagrams & Code Brown County Library

Introduction to Arduino Diagrams & Code Brown County Library Introduction to Arduino Diagrams & Code Project 01: Blinking LED Components needed: Arduino Uno board LED Put long lead into pin 13 // Project 01: Blinking LED int LED = 13; // LED connected to digital

More information

Serial.begin ( ); Serial.println( ); analogread ( ); map ( );

Serial.begin ( ); Serial.println( ); analogread ( ); map ( ); Control and Serial.begin ( ); Serial.println( ); analogread ( ); map ( ); A system output can be changed through the use of knobs, motion, or environmental conditions. Many electronic systems in our world

More information

LDR_Light_Switch1 -- Overview

LDR_Light_Switch1 -- Overview LDR_Light_Switch1 -- Overview OBJECTIVES After performing this lab exercise, learner will be able to: Understand the functionality of Light Dependent Resistor (LDR) Use LDR (Light Dependent Resistor) to

More information

Introduction To Arduino

Introduction To Arduino Introduction To Arduino What is Arduino? Hardware Boards / microcontrollers Shields Software Arduino IDE Simplified C Community Tutorials Forums Sample projects Arduino Uno Power: 5v (7-12v input) Digital

More information

DFRduino Beginner Kit For Arduino V3 SKU:DFR0100

DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 DFRduino Beginner Kit For Arduino V3 SKU:DFR0100 Contents 1 Introduction 2 Getting Started with Arduino 3 Tutorial 3.1 Blinking a LED 3.2 SOS Beacon 3.3 Traffic Light 3.4 Fading Light 3.5 RGB LED 3.6 Alarm

More information

LDR_Light_Switch5 -- Overview

LDR_Light_Switch5 -- Overview LDR_Light_Switch5 -- Overview OBJECTIVES After performing this lab exercise, learner will be able to: Interface LDR and pushbutton with Arduino to make light controlled switch Program Arduino board to:

More information

SX1509 I/O Expander Breakout Hookup Guide

SX1509 I/O Expander Breakout Hookup Guide Page 1 of 16 SX1509 I/O Expander Breakout Hookup Guide Introduction Is your Arduino running low on GPIO? Looking to control the brightness of 16 LEDs individually? Maybe blink or breathe a few autonomously?

More information

Connecting Arduino to Processing

Connecting Arduino to Processing Connecting Arduino to Processing Introduction to Processing So, you ve blinked some LEDs with Arduino, and maybe you ve even drawn some pretty pictures with Processing - what s next? At this point you

More information

FUNCTIONS For controlling the Arduino board and performing computations.

FUNCTIONS For controlling the Arduino board and performing computations. d i g i t a l R e a d ( ) [Digital I/O] Reads the value from a specified digital pin, either HIGH or LOW. digitalread(pin) pin: the number of the digital pin you want to read HIGH or LOW Sets pin 13 to

More information

Note. The above image and many others are courtesy of - this is a wonderful resource for designing circuits.

Note. The above image and many others are courtesy of   - this is a wonderful resource for designing circuits. Robotics and Electronics Unit 2. Arduino Objectives. Students will understand the basic characteristics of an Arduino Uno microcontroller. understand the basic structure of an Arduino program. know how

More information

Robotics and Electronics Unit 5

Robotics and Electronics Unit 5 Robotics and Electronics Unit 5 Objectives. Students will work with mechanical push buttons understand the shortcomings of the delay function and how to use the millis function. In this unit we will use

More information

University of Hull Department of Computer Science C4DI Interfacing with Arduinos

University of Hull Department of Computer Science C4DI Interfacing with Arduinos Introduction Welcome to our Arduino hardware sessions. University of Hull Department of Computer Science C4DI Interfacing with Arduinos Vsn. 1.0 Rob Miles 2014 Please follow the instructions carefully.

More information

EXPERIMENT 7 Please visit https://www.arduino.cc/en/reference/homepage to learn all features of arduino before you start the experiments

EXPERIMENT 7 Please visit https://www.arduino.cc/en/reference/homepage to learn all features of arduino before you start the experiments EXPERIMENT 7 Please visit https://www.arduino.cc/en/reference/homepage to learn all features of arduino before you start the experiments TEMPERATURE MEASUREMENT AND CONTROL USING LM35 Purpose: To measure

More information

WEEK PRactice. Turning on LED with a Switch. Learning Objective. Materials to Prepare. Summary of Class. Project Goal. Hardware Expression

WEEK PRactice. Turning on LED with a Switch. Learning Objective. Materials to Prepare. Summary of Class. Project Goal. Hardware Expression WEEK 04 Have LED My Way PRactice Turning on LED with a Switch Do you remember the project we worked on in week 3? It was a program that had making board s LED blink every second through a simple program.

More information

HOW TO INSTALL YAKINDU AND TRICKS ABOUT IT

HOW TO INSTALL YAKINDU AND TRICKS ABOUT IT HOW TO INSTALL YAKINDU AND TRICKS ABOUT IT 1-Installation First you need to download the YAKINDU Statechart Tools. Unzip the archive to an arbitrary directory and start SCT. Choose "Install New Software..."

More information

Digital I/O Operations

Digital I/O Operations Digital I/O Operations CSE0420 Embedded Systems By Z. Cihan TAYŞİ Outline Digital I/O Ports, Pins Direction Pull-up & pull-down Arduino programming Digital I/O examples on Arduino 1 Digital I/O Unlike

More information

Chapter 2 The Basic Functions

Chapter 2 The Basic Functions Chapter 2 The Basic Functions 2.1 Overview The code you learn to write for your Arduino is very similar to the code you write in any other computer language. This implies that all the basic concepts remain

More information

8051 Microcontroller Interrupts

8051 Microcontroller Interrupts 8051 Microcontroller Interrupts There are five interrupt sources for the 8051, which means that they can recognize 5 different events that can interrupt regular program execution. Each interrupt can be

More information

Look closely at this schematic diagram, in thid class you will be asked to construct this circuit WITHOUT using the textbook!

Look closely at this schematic diagram, in thid class you will be asked to construct this circuit WITHOUT using the textbook! LEARNING TO READ SCHEMATIC DIAGRAMS So far you have been constructing the circuits by following the detailed pictures in the textbook. For example, you were following the pictures to connect the LED between

More information

Make your own secret locking mechanism to keep unwanted guests out of your space!

Make your own secret locking mechanism to keep unwanted guests out of your space! KNOCK LOCK Make your own secret locking mechanism to keep unwanted guests out of your space! Discover : input with a piezo, writing your own functions Time : 1 hour Level : Builds on projects : 1,,3,4,5

More information

ArdOS The Arduino Operating System Quick Start Guide and Examples

ArdOS The Arduino Operating System Quick Start Guide and Examples ArdOS The Arduino Operating System Quick Start Guide and Examples Contents 1. Introduction... 1 2. Obtaining ArdOS... 2 3. Installing ArdOS... 2 a. Arduino IDE Versions 1.0.4 and Prior... 2 b. Arduino

More information

Lab 2 - Powering the Fubarino. Fubarino,, Intro to Serial, Functions and Variables

Lab 2 - Powering the Fubarino. Fubarino,, Intro to Serial, Functions and Variables Lab 2 - Powering the Fubarino Fubarino,, Intro to Serial, Functions and Variables Part 1 - Powering the Fubarino SD The Fubarino SD is a 56 pin device. Each pin on a chipkit device falls broadly into one

More information

LDR_Light_Switch2 -- Overview

LDR_Light_Switch2 -- Overview LDR_Light_Switch2 -- Overview OBJECTIVES After performing this lab exercise, learner will be able to: Use LDR (Light Dependent Resistor) to measure the light intensity variation in terms of voltage at

More information

Project 2: Sensor Light

Project 2: Sensor Light Project 2: Sensor Light In this session, we will create a sensor light. The behavior we want to implement is as follows: - When the sensor detects human motion, the LED light will be on - When no human

More information

MAE106 Laboratory Exercises Lab # 1 - Laboratory tools

MAE106 Laboratory Exercises Lab # 1 - Laboratory tools MAE106 Laboratory Exercises Lab # 1 - Laboratory tools University of California, Irvine Department of Mechanical and Aerospace Engineering Goals To learn how to use the oscilloscope, function generator,

More information

University of Portland EE 271 Electrical Circuits Laboratory. Experiment: Arduino

University of Portland EE 271 Electrical Circuits Laboratory. Experiment: Arduino University of Portland EE 271 Electrical Circuits Laboratory Experiment: Arduino I. Objective The objective of this experiment is to learn how to use the Arduino microcontroller to monitor switches and

More information

Juniper: A Functional Reactive Programming Language for the Arduino

Juniper: A Functional Reactive Programming Language for the Arduino Juniper: A Functional Reactive Programming Language for the Arduino Caleb Helbling Tufts University Samuel Z. Guyer Tufts University Workshop on Functional Art, Music, Modelling and Design (FARM) September

More information

ESP32 WIFI/BLE Board v0.9

ESP32 WIFI/BLE Board v0.9 ESP32 WIFI/BLE Board v0.9 From Elecrow Contents 1 Introduction 2 Feactures 3 Specification 4 Interface Function 5 Usage 5.1 Installing the ESP32 Arduino Core 5.1.1 Download the Core 5.1.2 Install the Xtensa

More information

Blinking an LED 1 PARTS: Circuit 2 LED. Wire. 330Ω Resistor

Blinking an LED 1 PARTS: Circuit 2 LED. Wire. 330Ω Resistor Circuit PIN 3 RedBoard Blinking an LED LED (Light-Emitting Diode) Resistor (33 ohm) (Orange-Orange-Brown) LEDs (light-emitting diodes) are small, powerful lights that are used in many different applications.

More information

TANGIBLE MEDIA & PHYSICAL COMPUTING INTRODUCTION TO ARDUINO

TANGIBLE MEDIA & PHYSICAL COMPUTING INTRODUCTION TO ARDUINO TANGIBLE MEDIA & PHYSICAL COMPUTING INTRODUCTION TO ARDUINO AGENDA ARDUINO HARDWARE THE IDE & SETUP BASIC PROGRAMMING CONCEPTS DEBUGGING & HELLO WORLD INPUTS AND OUTPUTS DEMOS ARDUINO HISTORY IN 2003 HERNANDO

More information

Digital Pins and Constants

Digital Pins and Constants Lesson Lesson : Digital Pins and Constants Digital Pins and Constants The Big Idea: This lesson is the first step toward learning to connect the Arduino to its surrounding world. You will connect lights

More information

Memo on development of the car-rangefinder device/data logger for crosswalk study

Memo on development of the car-rangefinder device/data logger for crosswalk study Memo on development of the car-rangefinder device/data logger for crosswalk study -Alex Bigazzi; abigazzi@pdx.edu; alexbigazzi.com; Sept. 16 th -19 th, 2013 The device is supposed to measure distances

More information

Robotics/Electronics Review for the Final Exam

Robotics/Electronics Review for the Final Exam Robotics/Electronics Review for the Final Exam Unit 1 Review. 1. The battery is 12V, R1 is 400 ohms, and the current through R1 is 20 ma. How many ohms is R2? ohms What is the voltage drop across R1? V

More information

Laboratory 1 Introduction to the Arduino boards

Laboratory 1 Introduction to the Arduino boards Laboratory 1 Introduction to the Arduino boards The set of Arduino development tools include µc (microcontroller) boards, accessories (peripheral modules, components etc.) and open source software tools

More information

Software debouncing of buttons

Software debouncing of buttons Software debouncing of buttons snigelen February 5, 2015 1 Introduction Connecting a button as an input to a micro-controller is a relatively easy task, but there are some problems. The main problem is

More information

Connecting Arduino to Processing a

Connecting Arduino to Processing a Connecting Arduino to Processing a learn.sparkfun.com tutorial Available online at: http://sfe.io/t69 Contents Introduction From Arduino......to Processing From Processing......to Arduino Shaking Hands

More information

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Lab Test III

UNIVERSITY OF CONNECTICUT. ECE 3411 Microprocessor Application Lab: Fall Lab Test III Department of Electrical and Computing Engineering UNIVERSITY OF CONNECTICUT ECE 3411 Microprocessor Application Lab: Fall 2015 Lab Test III There are 2 longer programming problems in this test. There

More information

Arduino Uno. Power & Interface. Arduino Part 1. Introductory Medical Device Prototyping. Digital I/O Pins. Reset Button. USB Interface.

Arduino Uno. Power & Interface. Arduino Part 1. Introductory Medical Device Prototyping. Digital I/O Pins. Reset Button. USB Interface. Introductory Medical Device Prototyping Arduino Part 1, http://saliterman.umn.edu/ Department of Biomedical Engineering, University of Minnesota Arduino Uno Power & Interface Reset Button USB Interface

More information

Smart Objects. SAPIENZA Università di Roma, M.Sc. in Product Design Fabio Patrizi

Smart Objects. SAPIENZA Università di Roma, M.Sc. in Product Design Fabio Patrizi Smart Objects SAPIENZA Università di Roma, M.Sc. in Product Design Fabio Patrizi 1 What is a Smart Object? Essentially, an object that: Senses Thinks Acts 2 Example 1 https://www.youtube.com/watch?v=6bncjd8eke0

More information

Create your own wireless motion sensor with

Create your own wireless motion sensor with Create your own wireless motion sensor with Arduino If you have a friend that has an alarm system in his or her home, I am sure you ve all seen these white motion sensors that are usually fixed above doors

More information

Sensors and Motor Control Lab

Sensors and Motor Control Lab Sensors and Motor Control Lab ILR - 1 Amit Agarwal Team A Amit Agarwal, Harry Golash, Yihao Qian, Menghan Zhang, Zihao (Theo) Zhang October 14, 2016 Table of Contents 1. Individual Progress 1.1 DC Motor

More information

IME-100 ECE. Lab 4. Electrical and Computer Engineering Department Kettering University. G. Tewolde, IME100-ECE,

IME-100 ECE. Lab 4. Electrical and Computer Engineering Department Kettering University. G. Tewolde, IME100-ECE, IME-100 ECE Lab 4 Electrical and Computer Engineering Department Kettering University 4-1 1. Laboratory Computers Getting Started i. Log-in with User Name: Kettering Student (no password required) ii.

More information

Project 17 Shift Register 8-Bit Binary Counter

Project 17 Shift Register 8-Bit Binary Counter Project 17 Shift Register 8-Bit Binary Counter In this project, you re going to use additional ICs (Integrated Circuits) in the form of shift registers in order to drive LEDs to count in binary (I will

More information

Basic Input/Output Operations

Basic Input/Output Operations Basic Input/Output Operations Posted on May 9, 2008, by Ibrahim KAMAL, in Micro-controllers, tagged In this third part of the 89s52 tutorial, we are going to study the basic structure and configuration

More information

Overview. Multiplexor. cs281: Introduction to Computer Systems Lab02 Basic Combinational Circuits: The Mux and the Adder

Overview. Multiplexor. cs281: Introduction to Computer Systems Lab02 Basic Combinational Circuits: The Mux and the Adder cs281: Introduction to Computer Systems Lab02 Basic Combinational Circuits: The Mux and the Adder Overview The objective of this lab is to understand two basic combinational circuits the multiplexor and

More information

How to Use an Arduino

How to Use an Arduino How to Use an Arduino By Vivian Law Introduction The first microcontroller, TMS-1802-NC, was built in 1971 by Texas Instruments. It owed its existence to the innovation and versatility of silicon and the

More information

Introduction to Internet of Things Prof. Sudip Misra Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Introduction to Internet of Things Prof. Sudip Misra Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Introduction to Internet of Things Prof. Sudip Misra Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Lecture - 23 Introduction to Arduino- II Hi. Now, we will continue

More information

Arduino 101 AN INTRODUCTION TO ARDUINO BY WOMEN IN ENGINEERING FT T I NA A ND AW E S O ME ME NTO R S

Arduino 101 AN INTRODUCTION TO ARDUINO BY WOMEN IN ENGINEERING FT T I NA A ND AW E S O ME ME NTO R S Arduino 101 AN INTRODUCTION TO ARDUINO BY WOMEN IN ENGINEERING FT T I NA A ND AW E S O ME ME NTO R S Overview Motivation Circuit Design and Arduino Architecture Projects Blink the LED Switch Night Lamp

More information

VKey Voltage Keypad Hookup Guide

VKey Voltage Keypad Hookup Guide Page 1 of 8 VKey Voltage Keypad Hookup Guide Introduction If you need to add a keypad to your microcontroller project, but don t want to use up a lot of I/O pins to interface with it, the VKey is the solution

More information

ARDUINO MICRO WITHOUT HEADERS Code: A000093

ARDUINO MICRO WITHOUT HEADERS Code: A000093 ARDUINO MICRO WITHOUT HEADERS Code: A000093 Arduino Micro is the smallest board of the family, easy to integrate it in everyday objects to make them interactive. The Micro is based on the ATmega32U4 microcontroller

More information

SPDM Level 2 Smart Electronics Unit, Level 2

SPDM Level 2 Smart Electronics Unit, Level 2 SPDM Level 2 Smart Electronics Unit, Level 2 Evidence Folder John Johns Form 3b RSA Tipton 1.1 describe the purpose of circuit components and symbols. The candidate can describe the purpose of a range

More information

Review of the syntax and use of Arduino functions, with special attention to the setup and loop functions.

Review of the syntax and use of Arduino functions, with special attention to the setup and loop functions. Living with the Lab Fall 2011 What s this void loop thing? Gerald Recktenwald v: October 31, 2011 gerry@me.pdx.edu 1 Overview This document aims to explain two kinds of loops: the loop function that is

More information

TABLE OF CONTENTS INTRODUCTION LESSONS PROJECTS

TABLE OF CONTENTS INTRODUCTION LESSONS PROJECTS TABLE OF CONTENTS INTRODUCTION Introduction to Components - Maker UNO 5 - Maker UNO Board 6 - Setting Up - Download Arduino IDE 7 - Install Maker UNO Drivers - Install Maker UNO Board Package 3 LESSONS.

More information

Create moving images in forward and reverse with your Arduino when you connect a motor to an H-bridge and some still images BATTERY POTENTIOMETER

Create moving images in forward and reverse with your Arduino when you connect a motor to an H-bridge and some still images BATTERY POTENTIOMETER ZOETROPE Create moving images in forward and reverse with your Arduino when you connect a motor to an H-bridge and some still images Discover : H-bridges Time : 30 minutes Level : Builds on projects :

More information

Arduino. part A. slides rel. 4.3 free documentation. Renato Conte Arduino - 1 /82 -

Arduino. part A. slides rel. 4.3 free documentation. Renato Conte Arduino - 1 /82 - Arduino part A slides rel. 4.3 free documentation 2015 Renato Conte Arduino - 1 /82 - Part A Contents What is Arduino? What is an embedded system? The microcontroller Atmega168 / 328 The Arduino board

More information

Arduino notes IDE. Serial commands. Arduino C language. Program structure. Arduino web site:

Arduino notes IDE. Serial commands. Arduino C language. Program structure. Arduino web site: 1 Arduino notes This is not a tutorial, but a collection of personal notes to remember the essentials of Arduino programming. The program fragments are snippets that represent the essential pieces of code,

More information

keyestudio Keyestudio MEGA 2560 R3 Board

keyestudio Keyestudio MEGA 2560 R3 Board Keyestudio MEGA 2560 R3 Board Introduction: Keyestudio Mega 2560 R3 is a microcontroller board based on the ATMEGA2560-16AU, fully compatible with ARDUINO MEGA 2560 REV3. It has 54 digital input/output

More information

Home Automation With Arduino

Home Automation With Arduino Home Automation With Arduino Automate Your Home Using Open-Source Hardware Marco Schwartz, PhD Contents Legal Acknowledgments About the author About the companion website Preface to the First Edition Preface

More information

18-heater Arduino code

18-heater Arduino code 18-heater Arduino code Modified from original code by Charith Fernanado: http://www.inmojo.com charith@inmojo.com #include // Creation of variables volatile int idimmer=0; volatile boolean

More information

Quick Start by JP Liew

Quick Start by JP Liew Quick Start Page 1 of 8 Quick Start by JP Liew Thank you backing our Kickstarter project. Before we get underway with setting up your MicroView, you should make sure you have got everything you need. Unboxing

More information