Robotics and Electronics Unit 5
|
|
- Hilary Conley
- 5 years ago
- Views:
Transcription
1 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 mechanical push buttons instead of the capacitive buttons that we used in unit 2. These buttons have four prongs to make them easier to attach to breadboards. The four pins also allow the buttons to be used in more complicated circuits (that we will not have to worry about). For this class, always position a push button over the center of the breadboard (as shown in the figure). Exercise 1. Build one circuit with a button, 330-ohm resistor (orange-orangebrown), and a LED. When the button is pressed, the LED goes on. When the button is not pressed, the LED is off. Do this without writing any code. Just use the Arduino as a power source. Make sure that the current runs through the resistor, LED, and button. There are multiple ways to do this correctly. Exercise 2. Build the circuit and copy/run the code. Use a 10k resistor (brown-black-orange). void setup(){ pinmode( 8, INPUT ); void loop(){ int x = digitalread( 8 ); if ( x == HIGH ) Serial.println( "PRESSED" ); else Serial.println( "Not pressed" ); Copy and run this code. You should see PRESSED when the button is pressed and Not pressed when the button is not pressed. The 10k resistor is needed so that when the button is pressed there will not be a The 10k resistor is also needed when the button is not pressed. Without the resistor, pin 8 is not connect a circuit and it will float and return random values. 1
2 Exercise 3. Build the same button circuit we used in exercise 2. Copy and run this code. What is displayed if you click the button once? Think about why the circuit/code behaves this way. pinmode( 8, INPUT ); int x = digitalread( 8 ); if ( x == HIGH ) { Exercise 4. Use the same circuit as before but copy/run this code. Occasionally the program may count one click as two clicks. There is a reason for this, but we will ignore that problem for the time being. int oldx = LOW; pinmode( 5, INPUT ); int x = digitalread( 5 ); if ( x == HIGH && oldx ==LOW ) { oldx= x; Exercise 5. Build three circuits: a red LED circuit, a green LED circuit, and a button circuit. Once the button has been pressed three times, the red LED turns on and stays on. Once the button has been clicked a total of 6 times, the green LED turns on (so now there are two lights on). After that both buttons stay on. If you click slowly and carefully, it should work fine. If you click the button fast, you might find that it does not count quite correctly. It may be off by one. This is due to something called bounce. When the button is pressed, and the metal contacts hit each other (inside the button), there is some bounce at the microscopic level. There are ways to take care of this with either software or hardware but we take the third way of dealing with this problem ignoring it. At least for now. IMPORTANT. Do not use the delay function. You do not need it in this exercise and it will complicate matters (we will address this later). 2
3 Exercise 6. Use the same circuits as you built for the previous exercise except you will write a different program so that it behaves differently. When the program starts, both LEDs are off. Click once and the red LED is on and the green LED is off. Click a second time and the red LED is off and the green LED is on. Click a third time and both LEDs are on. Click a fourth time and both LEDs are off again. Every click after that repeats the above sequence. Hint. Create a global variable. Every time the button is clicked, add one to that variable. At a certain point, set this variable back to zero so that the sequence repeats. IMPORTANT. Do not use the delay function. More Data Types Limits Memory int a; integer from -32,768 to 32, bits unsigned int b; integer from 0 to 65, bits long c; integer from -2,147,483,648 to 2,147,483, bits unsigned long d; integer from 0 to 4,294,967, bits Unsigned means that the integer cannot be negative The millis function returns an unsigned long integer that is the number of milliseconds that have passed since the program started. To the right is some sample code. On the far right is the output from the code. unsigned long k = millis(); Serial.println( k ); unsigned long t = millis(); if ( t >= && t <= ) Serial.println( t ); 0 Exercise 7. Build a button circuit. Write a program so that when the user clicks the button, it displays the number of milliseconds since the program started. You will need to use the millis function described above. Print the word Start in the setup function. To the right is a sample run. Even though I only clicked twice, five numbers are displayed because of bounce. I first clicked 2,588 milliseconds after the program started and there was a bounce 93 milliseconds later. The second click generated two bounces: I clicked 7,799 milliseconds after the program started and then there was a bounce 104 milliseconds later and a second bounce 3 milliseconds after that. 3
4 Exercise 8. There is no circuit with this exercise; just copy the code and run it. Write down a few of the numbers being displayed: How much time passes between each number being displayed? unsigned long oldtime = 0; unsigned long count = 0; Serial.println( "Start" ); unsigned long t = millis(); if ( t - oldtime >= 1000 ) { oldtime = t; count = 0; Exercise 9. You do not build or program anything for this exercise. Pretend you have a working button circuit. The code to the right is identical to the code in exercise 4 except that one additional line of code was added. Circle that line of code. If the user clicks on the button three times a second, what is value of variable count at the end of four seconds? Consider the impact of that additional line of code. int oldx = LOW; pinmode( 5, INPUT ); int x = digitalread( 5 ); if ( x == HIGH && oldx ==LOW ) { oldx= x; delay( 0 ); Exercise 10. There is no circuit for this exercise. Complete the program so that it prints the Start, 1000, 2000, 3000, and so on (as shown in the figure). There should be a one second interval between each number being printed without using the delay function. There should also be a one second interval between Start and 1000 being printed. unsigned long oldtime = 0; Serial.println( "Start" ); unsigned long currenttime = millis(); if ( ) { Serial.println( currenttime ); Do not use the delay function. 4
5 Exercise 11. Because of bounce, we cannot accurately count the number of times the button was clicked. In this exercise we handle bounce by using the millis function. We will define a click as occurring when (1) the voltage (as detected by digitalread) goes from LOW to HIGH and (2) it has been more than 200 milliseconds since the last time the voltage went from LOW to HIGH. Note. 200 is a relatively arbitrary number based on some tests I ran. We want it to be large enough to eliminate one click being registered multiple times but not so large that legitimate multiple clicks are missed. Build a button circuit using a 10k resistor as you ve done in previous exercises. Copy the outline below and fill in the blanks. When you are done, run the program and click the button. You should find that it keeps a much more accurate count of the number of times the button was clicked. unsigned long lastclicktime = 0; int lastread = LOW; pinmode(, INPUT ); Serial.println( "Start" ); int b = digitalread( ); unsigned long currenttime = millis(); if ( the voltage is currently high but used to be low AND it has been 200 ms or more since the last click ) { Exercise 12. Build a button circuit (10k resistor, brown-black-orange) and a speaker circuit (100 ohm resistor, brown-black-brown). When the program starts, the speaker is playing a 300 hz tone. After the button is clicked 3 times, the frequency changes to hz. After 6 clicks it changes to 700 hz and stays at there. Follow the outline on the right. 3 global variables void setup(){ call the pinmode function twice void loop(){ code that counts the number of clicks use the millis function as in exercise 11 if the count is less than 3, play 300 else if the count is less than 6, then else play 700 5
6 Exercise 13a. Build two separate LED circuits that are connected to pins 9 and 10 - don t forget the 330, orange-orange-brown, resistors. Complete the program below so that one LED is on and the other is off; then 2 seconds later, the first LED goes off and the second LED goes on for 2 seconds. And so on. Do NOT use the delay function. Note: we did this program back in unit 2 using the delay function and this version is more complicated. You might think unnecessarily more complicated. However, in part 12b we will modify the program to do something that cannot be done using the delay function. unsigned long lasttime = 0; off int pin9 = HIGH; // track the last time we changed which LED is on and which is // track whether this LED is on or off This is a nested if statement because it is nested inside of another if statement. pinmode( 9, OUTPUT ); pinmode( 10, OUTPUT ); unsigned long currenttime = millis(); if ( two seconds have passed ) { if ( pin9 == HIGH ) { digitalwrite( 9, LOW ); digitalwrite( 10, HIGH ); do something to the variable pin9 else { digitalwrite( 9, HIGH ); digitalwrite( 10, LOW ); do something to the variable pin9 one more line of code for you to figure out Important. The variable pin9 does not cause an LED to go on or off; we are using it to track whether that LED is on or off. Exercise 13b. Build a button circuit (keep the two LED circuits). Modify the program so that while the LEDs are blinking on and off, it also keeps an accurate count of the number of times the button is clicked - these numbers should be printed using Serial.println. This code can go below the code from part 12a (but still be in the loop function). There are times, especially in simple programs, where the delay function is useful. But in general, you want your program to do multiple things at the same time (or at least feel like it is happening at the same time). For that, you need the millis function. 6
7 Exercise 14. We are building a very simple game. There is a speaker and it plays the following frequencies, in this order: 200, 300, 400,, 600, 700, and then repeats starting at 200 again. Each tone plays for 1 second. There is a button. If the user clicks the button when the 400 tone is playing, the program prints YOU WIN! If the user clicks while any other tone is playing, it prints You lose. Clicking the button does not stop the sound. Use a global variable to track which frequency is currently being played. four global variables usual stuff two statements if ( the button has been clicked ){ if ( the current frequency is 400 ) Serial.println( "YOU WIN!" ); else Serial.println( "You lose." ); update the variable that tracks the last time the button was clicked. update the variable that tracks the previous state of the button if ( one second has passed ) { update which frequency is playing play that frequency update the variable that tracks the last time the frequency was changed. We will revisit this program in the next unit and learn ways to make the program more interesting and learn ways to organize the code better. 7
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 informationRobotics/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 informationLesson 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 informationUniversity 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 informationProcedure: Determine the polarity of the LED. Use the following image to help:
Section 2: Lab Activity Section 2.1 Getting started: LED Blink Purpose: To understand how to upload a program to the Arduino and to understand the function of each line of code in a simple program. This
More informationHalloween Pumpkinusing. Wednesday, October 17, 12
Halloween Pumpkinusing Blink LED 1 What you will need: 1 MSP-EXP430G2 1 3 x 2 Breadboard 3 560 Ohm Resistors 3 LED s (in Red Color Range) 3 Male to female jumper wires 1 Double AA BatteryPack 2 AA Batteries
More informationCoding Workshop. Learning to Program with an Arduino. Lecture Notes. Programming Introduction Values Assignment Arithmetic.
Coding Workshop Learning to Program with an Arduino Lecture Notes Table of Contents Programming ntroduction Values Assignment Arithmetic Control Tests f Blocks For Blocks Functions Arduino Main Functions
More informationMicrocontrollers 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 informationArdOS 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 informationArduino - 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 informationENGR 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 informationImperativ Programming. morning (again) Jens Dalsgaard Nielsen Aalborg University (1/24)
Imperativ Programming morning (again) Jens Dalsgaard Nielsen (jdn@es.aau.dk) Aalborg University (1/24) message Changed timing today Jens Dalsgaard Nielsen (jdn@es.aau.dk) Aalborg University (2/24) Jens
More information1/Build a Mintronics: MintDuino
1/Build a Mintronics: The is perfect for anyone interested in learning (or teaching) the fundamentals of how micro controllers work. It will have you building your own micro controller from scratch on
More informationAdapted 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 informationIME-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 informationSpecification. 1.Power Supply direct from Microcontroller Board. 2.The circuit can be used with Microcontroller Board such as Arduino UNO R3.
Part Number : Product Name : FK-FA1410 12-LED AND 3-BOTTON SHIELD This is the experimental board for receiving and transmitting data from the port of microcontroller. The function of FK-FA1401 is fundamental
More informationArduino 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 informationSmart 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 informationDigital 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 informationSerial.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 informationArduino 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 informationLab 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 informationButton 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 informationArduino 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 informationUniversity 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 informationElectronic Brick Starter Kit
Electronic Brick Starter Kit Getting Started Guide v1.0 by Introduction Hello and thank you for purchasing the Electronic Brick Starter Pack from Little Bird Electronics. We hope that you will find learning
More informationCounter & LED (LED Blink)
1 T.R.E. Meeting #1 Counter & LED (LED Blink) September 17, 2017 Contact Info for Today s Lesson: President Ryan Muller mullerr@vt.edu 610-573-1890 Learning Objectives: Learn how to use the basics of Arduino
More informationThe short program to blink the red LED used the delay() function. This is very handy function for introducing a short time delays into programs.
Timing The short program to blink the red LED used the delay() function. This is very handy function for introducing a short time delays into programs. It helps buffer the differing time scales of humans
More informationMore 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 informationD - Tic Tac Toe. Let's use our 9 sparkles to build a tic tac toe game! 2017 courses.techcamp.org.uk/ Page 1 of 9
D - Tic Tac Toe Let's use our 9 sparkles to build a tic tac toe game! 2017 courses.techcamp.org.uk/ Page 1 of 9 INTRODUCTION Let's use our 9 sparkles to build a tic tac toe game! Step 1 Assemble the Robot
More informationArduino 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 informationArduino Programming. Arduino UNO & Innoesys Educational Shield
Arduino Programming Arduino UNO & Innoesys Educational Shield www.devobox.com Electronic Components & Prototyping Tools 79 Leandrou, 10443, Athens +30 210 51 55 513, info@devobox.com ARDUINO UNO... 3 INNOESYS
More informationArduino 05: Digital I/O. Jeffrey A. Meunier University of Connecticut
Arduino 05: Digital I/O Jeffrey A. Meunier jeffm@engr.uconn.edu University of Connecticut About: How to use this document I designed this tutorial to be tall and narrow so that you can read it on one side
More informationPhysics 364, Fall 2012, Lab #9 (Introduction to microprocessor programming with the Arduino) Lab for Monday, November 5
Physics 364, Fall 2012, Lab #9 (Introduction to microprocessor programming with the Arduino) Lab for Monday, November 5 Up until this point we have been working with discrete digital components. Every
More informationIME-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 informationGOOD MORNING SUNSHINE
Item 11: Good Morning Sunshine Monday, 15 October 2018 12:30 PM GOOD MORNING SUNSHINE EXPLORE WALT: definition and decomposition of complex problems in terms of functional and non-functional requirements
More informationIntroduction 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 informationKNOCK LOCK MAKE YOUR OWN SECRET LOCKING MECHANISM TO KEEP UNWANTED GUESTS OUT OF YOUR SPACE! Discover: input with a piezo, writing your own functions
125 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, 2, 3,
More informationArduino 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 informationStenBOT Robot Kit. Stensat Group LLC, Copyright 2018
StenBOT Robot Kit 1 Stensat Group LLC, Copyright 2018 Legal Stuff Stensat Group LLC assumes no responsibility and/or liability for the use of the kit and documentation. There is a 90 day warranty for the
More information2SKILL. Variables Lesson 6. Remembering numbers (and other stuff)...
Remembering numbers (and other stuff)... Let s talk about one of the most important things in any programming language. It s called a variable. Don t let the name scare you. What it does is really simple.
More informationSchedule. Sanford Bernhardt, Sangster, Kumfer, Michalaka. 3:10-5:00 Workshop: Build a speedometer 5:15-7:30 Dinner and Symposium: Group 2
Schedule 8:00-11:00 Workshop: Arduino Fundamentals 11:00-12:00 Workshop: Build a follower robot 1:30-3:00 Symposium: Group 1 Sanford Bernhardt, Sangster, Kumfer, Michalaka 3:10-5:00 Workshop: Build a speedometer
More informationPDF 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 informationMAE106 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 informationArduino Programming and Interfacing
Arduino Programming and Interfacing Stensat Group LLC, Copyright 2017 1 Robotic Arm Experimenters Kit 2 Legal Stuff Stensat Group LLC assumes no responsibility and/or liability for the use of the kit and
More informationRotary 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 informationDigital Design through. Arduino
Digital Design through 1 Arduino G V V Sharma Contents 1 Display Control through Hardware 2 1.1 Powering the Display.................................. 2 1.2 Controlling the Display.................................
More informationMEDIS 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 informationCS12020 for CGVG. Practical 1. Jim Finnis
CS12020 for CGVG Practical 1 Jim Finnis (jcf1@aber.ac.uk) About me 20 years in the games industry (more or less) Windows, PS2, Xbox, Gamecube, Wii development experience DirectX (more than I like to think
More informationAssembly Instructions (8/14/2014) Your kit should contain the following items. If you find a part missing, please contact NeoLoch for a replacement.
NeoLoch NLT-28P-LCD-5S Assembly Instructions (8/14/2014) Your kit should contain the following items. If you find a part missing, please contact NeoLoch for a replacement. Kit contents: 1 Printed circuit
More informationIntroduction 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 informationBlinking 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 informationPart 1. Summary of For Loops and While Loops
NAME EET 2259 Lab 5 Loops OBJECTIVES -Understand when to use a For Loop and when to use a While Loop. -Write LabVIEW programs using each kind of loop. -Write LabVIEW programs with one loop inside another.
More informationIntroduction 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 informationECGR 4101/5101, Fall 2016: Lab 1 First Embedded Systems Project Learning Objectives:
ECGR 4101/5101, Fall 2016: Lab 1 First Embedded Systems Project Learning Objectives: This lab will introduce basic embedded systems programming concepts by familiarizing the user with an embedded programming
More informationIntroduction 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 informationProject 12 Piezo Sounder Melody Player
Project 12 Piezo Sounder Melody Player Rather than using the piezo to make annoying alarm sounds, why not use it to play a melody? You are going to get your Arduino to play the chorus of Puff the Magic
More informationBuilding your own special-purpose embedded system gadget.
Bare-duino Building your own special-purpose embedded system gadget. Saves a little money. You can configure the hardware exactly the way that you want. Plus, it s fun! bare-duino 1 Arduino Uno reset I/O
More informationGeneral Syntax. Operators. Variables. Arithmetic. Comparison. Assignment. Boolean. Types. Syntax int i; float j = 1.35; int k = (int) j;
General Syntax Statements are the basic building block of any C program. They can assign a value to a variable, or make a comparison, or make a function call. They must be terminated by a semicolon. Every
More informationWhich LED(s) turn on? May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 1
Which LED(s) turn on? May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 1 Lab 3b, 3c The LED Cube ENGR 40M Theo Diamandis Stanford University 04 May 2018 Overview Goal: To write
More informationDigital 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+ Inheritance. Sometimes we need to create new more specialized types that are similar to types we have already created.
+ Inheritance + Inheritance Classes that we design in Java can be used to model some concept in our program. For example: Pokemon a = new Pokemon(); Pokemon b = new Pokemon() Sometimes we need to create
More informationTutorial 7. Number Colour Black Brown Red Orange Yellow Green Blue Violet Gray White
Tutorial 7 Question 1. Write a C program which declares an array of 20 integers, and initialises them such that the first value is 1, the second 2, and so on, with the last value being 20. Use a loop to
More informationThe Big Idea: Background:
Lesson 7 Lesson 7: For For Loops Loops The Big Idea: This lesson simplifies the control of digital pins by assigning the pin numbers to an integer variable and by calling the digitalwrite command multiple
More informationcs281: Introduction to Computer Systems Lab03 K-Map Simplification for an LED-based Circuit Decimal Input LED Result LED3 LED2 LED1 LED3 LED2 1, 2
cs28: Introduction to Computer Systems Lab3 K-Map Simplification for an LED-based Circuit Overview In this lab, we will build a more complex combinational circuit than the mux or sum bit of a full adder
More informationPDF 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 informationFUNCTIONS 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 informationThumb 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 informationWALT: definition and decomposition of complex problems in terms of functional and non-functional requirements
Item 5: It's Totally Random Monday, 5 October 08 :5 PM IT'S TOTALLY RANDOM EXPLORE WALT: definition and decomposition of complex problems in terms of functional and non-functional requirements WILF - Defined
More informationIntro to Arduino. Zero to Prototyping in a Flash! Material designed by Linz Craig and Brian Huang
Intro to Arduino Zero to Prototyping in a Flash! Material designed by Linz Craig and Brian Huang Overview of Class Getting Started: Installation, Applications and Materials Electrical: Components, Ohm's
More informationArduino 6: Analog I/O part 1. Jeffrey A. Meunier University of Connecticut
Arduino 6: Analog I/O part 1 Jeffrey A. Meunier jeffm@engr.uconn.edu University of Connecticut About: How to use this document I designed this tutorial to be tall and narrow so that you can read it on
More informationArduino Programming Part 3. EAS 199A Fall 2010
Arduino Programming Part 3 EAS 199A Fall 2010 Overview Part I Circuits and code to control the speed of a small DC motor. Use potentiometer for dynamic user input. Use PWM output from Arduino to control
More informationMake 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[ the academy_of_code] Senior Beginners
[ the academy_of_code] Senior Beginners 1 Drawing Circles First step open Processing Open Processing by clicking on the Processing icon (that s the white P on the blue background your teacher will tell
More informationCS12020 (Computer Graphics, Vision and Games) Worksheet 1
CS12020 (Computer Graphics, Vision and Games) Worksheet 1 Jim Finnis (jcf1@aber.ac.uk) 1 Getting to know your shield First, book out your shield. This might take a little time, so be patient. Make sure
More informationEXPERIMENT 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 informationText Input and Conditionals
Text Input and Conditionals Text Input Many programs allow the user to enter information, like a username and password. Python makes taking input from the user seamless with a single line of code: input()
More informationNAME EET 2259 Lab 3 The Boolean Data Type
NAME EET 2259 Lab 3 The Boolean Data Type OBJECTIVES - Understand the differences between numeric data and Boolean data. -Write programs using LabVIEW s Boolean controls and indicators, Boolean constants,
More informationUsing PSpice to Simulate Transmission Lines K. A. Connor Summer 2000 Fields and Waves I
Using PSpice to Simulate Transmission Lines K. A. Connor Summer 2000 Fields and Waves I We want to produce the image shown above as a screen capture or below as the schematic of this circuit. R1 V1 25
More informationBasic 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 informationWhich LED(s) turn on?
Go to www.menti.com and use the code 90 95 79 Which LED(s) turn on? May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 1 Lab 3b, 3c The LED Cube ENGR 40M Theo Diamandis Stanford
More informationMAKE & COLLABORATE: SECRET KNOCK LOCK
MAKE & COLLABORATE: SECRET KNOCK LOCK A project from Arduino Project Handbook: 25 Practical Projects to Get You Started Project 9: Secret KnocK LocK For centuries clandestine groups have used Secret KnocKS
More informationInterrupts 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 informationIntroduction to Arduino
Introduction to Arduino Paco Abad May 20 th, 2011 WGM #21 Outline What is Arduino? Where to start Types Shields Alternatives Know your board Installing and using the IDE Digital output Serial communication
More informationBuild the Machine Science XBoard, with a programmable microcontroller.
Build the Machine Science XBoard, with a programmable microcontroller. Site: icode Course: Machine Science Guides Book: Assembling the XBoard Printed by: Guest User Date: Monday, May 24, 2010, 10:46 AM
More informationm-block By Wilmer Arellano
m-block By Wilmer Arellano You are free: to Share to copy, distribute and transmit the work Under the following conditions: Attribution You must attribute the work in the manner specified by the author
More informationOverview. 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 informationHow to Become an IoT Developer (and Have Fun!) Justin Mclean Class Software.
How to Become an IoT Developer (and Have Fun!) Justin Mclean Class Software Email: justin@classsoftware.com Twitter: @justinmclean Who am I? Freelance Developer - programming for 25 years Incubator PMC
More informationLecture 7. Processing Development Environment (or PDE)
Lecture 7 Processing Development Environment (or PDE) Processing Class Overview What is Processing? Installation and Intro. Serial Comm. from Arduino to Processing Drawing a dot & controlling position
More informationTechgirlz Workshop Scratch and Raspberry Pi
Techgirlz Workshop Scratch and Raspberry Pi Ruth Willenborg coderdojortp@gmail.com in conjunction with CoderDojo RTP Introduction: Thanks IBM: Raspberry Pi grant to Techgirlz Coderdojo and VMware: Raspberry
More informationIn this simple example, it is quite clear that there are exactly two strings that match the above grammar, namely: abc and abcc
JavaCC: LOOKAHEAD MiniTutorial 1. WHAT IS LOOKAHEAD The job of a parser is to read an input stream and determine whether or not the input stream conforms to the grammar. This determination in its most
More informationC Language Reference for ActivityBot. Driving the robot a specific distance or a specific amount of turn
Code for Driving ActivityBot C Language Reference for ActivityBot Jeffrey La Favre - November 4, 2015 There are two types of functions for driving the robot. The first kind specifies a specific distance
More informationSimple Sounders and Sensors
C H A P T E R 4 Simple Sounders and Sensors This chapter is going to get noisy. You re going to attach a piezo sounder to your Arduino in order to add alarms, warning beeps, alert notifications, etc. to
More informationCTEC 1802 Embedded Programming Labs
CTEC 1802 Embedded Programming Labs This document is intended to get you started using the Arduino and our I/O board in the laboratory - and at home! Many of the lab sessions this year will involve 'embedded
More informationENGR 40M Project 3c: Coding the raindrop pattern
ENGR 40M Project 3c: Coding the raindrop pattern For due dates, see the overview handout The raindrop pattern works like this: Once per time period (say, 150 ms), (a) move the pattern one plane down: the
More informationm-block By Wilmer Arellano
m-block By Wilmer Arellano You are free: to Share to copy, distribute and transmit the work Under the following conditions: Attribution You must attribute the work in the manner specified by the author
More informationOrbBasic Lesson 1 Goto and Variables: Student Guide
OrbBasic Lesson 1 Goto and Variables: Student Guide Sphero MacroLab is a really cool app to give the Sphero commands, but it s limited in what it can do. You give it a list of commands and it starts at
More informationQ1: Multiple choice / 20 Q2: C input/output; operators / 40 Q3: Conditional statements / 40 TOTAL SCORE / 100 EXTRA CREDIT / 10
EECE.2160: ECE Application Programming Spring 2016 Exam 1 February 19, 2016 Name: Section (circle 1): 201 (8-8:50, P. Li) 202 (12-12:50, M. Geiger) For this exam, you may use only one 8.5 x 11 double-sided
More informationEEG 101L INTRODUCTION TO ENGINEERING EXPERIENCE
EEG 101L INTRODUCTION TO ENGINEERING EXPERIENCE LABORATORY 1: INTRODUCTION TO ARDUINO IDE AND PROGRAMMING DEPARTMENT OF ELECTRICAL AND COMPUTER ENGINEERING UNIVERSITY OF NEVADA, LAS VEGAS 1. FYS KIT COMPONENTS
More informationIntroduction 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