Which LED(s) turn on? May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 1
|
|
- Jemimah Evans
- 5 years ago
- Views:
Transcription
1 Which LED(s) turn on? May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 1
2 Lab 3b, 3c The LED Cube ENGR 40M Theo Diamandis Stanford University 04 May 2018
3 Overview Goal: To write display(), which takes a pattern[][][] array and displays it on the LED cube. Challenges: Electrically, the LED cube actually an 8 8 grid. We d rather not think about time-division multiplexing. How can we write a function that allows to abstract these hardware details away from our main software? May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 3
4 Decomposition loop() The main Arduino loop calls display() which calls getledstate() Does one pass through the LEDs (time-division multiplexing) Looks up the LED state associated with an anode/cathode pair May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 4
5 loop() delegates to display() void loop() { byte pattern[4][4][4]; // (assemble the LEDs pattern) display(pattern); void display(byte pattern[4][4][4]) { for (byte anum = 0; anum < 8; anum++) { for (byte cnum = 0; cnum < 8; cnum++) { // LED multiplexing code May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 5
6 display() delegates to getledstate() void display(byte pattern[4][4][4]) { for (byte anum = 0; anum < 8; anum++) { for (byte cnum = 0; cnum < 8; cnum++) { byte value = getledstate(pattern, anum, cnum); // LED multiplexing code byte getledstate(byte pattern[4][4][4], byte anum, byte cnum) { // map from (a, c) to (x, y, z) return pattern[z][y][x]; May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 6
7 Review: Pin multiplexing anode (+) wires cathode ( ) wires May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 7
8 Review: Providing enough current Use a PMOS to provide enough power to the LEDs from Arduino May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 8
9 Implementing display() void display(byte pattern[4][4][4]) { for (byte anum = 0; anum < 8; anum++) { for (byte cnum = 0; cnum < 8; cnum++) { byte value = getledstate(pattern, anum, cnum); // Activate the cathode (-) wire (column) if value > 0, // deactivate it otherwise // Activate the anode (+) wire (row) // Wait a bit // Deactivate the anode (+) wire (row) May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 9
10 display() delegates to getledstate() void display(byte pattern[4][4][4]) { for (byte anum = 0; anum < 8; anum++) { for (byte cnum = 0; cnum < 8; cnum++) { byte value = getledstate(pattern, anum, cnum); // LED multiplexing code byte getledstate(byte pattern[4][4][4], byte anum, byte cnum) { // map from (a, c) to (x, y, z) return pattern[z][y][x]; May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 10
11 Mapping between 2-D and 3-D May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 11
12 Mapping between 2-D and 3-D We want a function that maps from anode/cathode pairs a, c (e.g. D6 ) to 3D coordinates x, y, z May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 12
13 Making the mapping function easier You can reorder the anodes/cathodes however you like. Would a different ordering make the relationship simpler? May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 13
14 Mapping between 2-D and 3-D May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 14
15 Mapping between 2-D and 3-D May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 15
16 Implementing getledstate() void getledstate(byte pattern[4][4][4], byte anum, byte cnum) { x =???; y =???; z =???; return pattern[z][y][x]; (Your function will probably be more than four lines.) May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 16
17 Decomposition loop() The main Arduino loop calls display() which calls getledstate() Does one pass through the LEDs (time-division multiplexing) Looks up the LED state associated with an anode/cathode pair May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 17
18 A note on coding style Why indentation matters: for(int i = 0; i < 5; i++){ for(int j = 0; j < 2; j++){ if(i == 0 && j == 0) print("hello!\n"); print("hello!\n"); May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 18
19 A few pointers Give variables sensible names byte whichone; byte currentpatternindex; Use constants for things that shouldn t change const byte TEST_PIN = 3; Watch out for = and == if (x = 3) { // always true print("winning!"); May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 19
20 A note on coding style I honestly didn't think you could even USE emoji in variable names. Or that there were so many different crying ones. May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 20
21 Planning your breadboard May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 21
22 What makes a good breadboard layout? Easy to follow Wires are relatively direct (and color-coded) No spaghetti-like crossovers Resistors don t touch each other Your cube wiring should also be neat Try to keep fairly compact, to allow for things to add next week! May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 22
23 Breadboard style Please don t: May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 23
24 Planning your breadboard May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 24
25 Overview of lab 3c Your task is to get your cube to respond to some sort of input. For most of you, this will involve adding hardware. You choose what you want to do, subject to minimum requirements. May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 25
26 Our suggestions for input Serial data Potentiometer Pushbutton switches (or other switches) Audio Capacitive touch sensing You re free (and encouraged) to propose something else, but be sure to tell your TA well in advance! May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 26
27 Serial data You ve already used the Serial Monitor You can also write computer software to interact with the serial port directly If you only respond to serial data, we ll expect to see some impressive software May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 27
28 Analog-to-digital converter analogread() reads the voltage on the pin, scaled to be a number between 0 and 1023 void loop() { int reading = analogread(a3); Serial.println(reading); Serial Monitor: May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 28
29 Potentiometer Essentially a variable voltage divider standard symbol internal mechanics photo May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 29
30 Potentiometer Essentially a variable voltage divider R1 and R2 vary with the wiper, but R1 + R2 = constant May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 30
31 Potentiometer Connect the wiper to the analog input Read using analogread() May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 31
32 Audio You can connect an audio output to your Arduino almost. May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 32
33 Audio analogread() the instantaneous value The input will be centered at 2.5 V, so you ll need to process it in software An additional handout guides you through this May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 33
34 Audio frequency response The ArduinoFFT3 library can process your signal to return a frequency-domain representation Implements the fast Fourier transform, an algorithm which computes a close cousin of the Fourier series An additional handout guides you through this Video: May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 34
35 Audio frequency response May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 35
36 Pushbutton switch SPST, momentary and normally open (sometimes known as push-to-make) May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 36
37 Pushbutton switch: debouncing What we think a switch does: What it actually does: May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 37
38 Pushbutton switch: debouncing As the switch bounces, the Arduino can register many transitions Dealing with this is called debouncing An additional handout guides you through this May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 38
39 Programming a pattern Since you ve abstracted away the timemultiplexing part, displaying a pattern consists mainly of filling in the pattern array. Recall triply-nested loops: for (int z = 0; z < 4; z++) { for (int y = 0; y < 4; y++) { for (int x = 0; x < 4; x++) { pattern[z][y][x] = (some value); May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 39
40 Raindrop pattern The raindrop pattern looks like rain is falling from the top of the cube to the bottom Videos May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 40
41 Raindrop pattern Every time period (say, 150 ms): 1. Move the pattern down by one plane 2. Choose an LED at random in the top plane May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 41
42 Timing and inputs Update the pattern once every (say) second With no inputs, this will work: void loop() { static byte ledon[4][4][4]; updatepattern(ledon); // updates pattern delay(1000); May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 42
43 Timing and inputs Stop/start whenever the button is pressed Why won t this work? void loop() { static byte ledon[4][4][4]; static bool running = false; if (running) updatepattern(ledon); if (digitalread(button) == HIGH) running =!running; delay(1000); // updates pattern May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 43
44 Timing and inputs Better: Check button without delay void loop() { static byte ledon[4][4][4]; static bool running = false; static long nextupdatetime = millis(); if (millis() > nextupdatetime) { if (running) updatepattern(ledon); // updates pattern nextupdatetime += 1000; if (digitalread(button) == HIGH) running =!running; May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 44
45 Complexity requirements Minimum requirement: cubes: 25; 6 6 planes: 35; larger planes: 30 Must do one additional handout, or propose your own Details are in the overview handout Points Hardware Software 5 No additional hardware (includes serial data) Simple response 10 Minor additional hardware Minor complexity Raindrop pattern 15 Moderate additional hardware Pushbuttons Audio non-frequency Moderate complexity 20 Complex additional hardware Impressive complexity May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 45
46 Programming Review
47 Arrays in C An array is a sequential collection of elements of the same data type e.g. int myarr[7]; declares space for seven ints: myarr[0] myarr[1] myarr[2] myarr[3] myarr[4] myarr[5] myarr[6] These are stored next to each other in memory. May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 47
48 Arrays in C You can access array elements with []: int fourthelement = myarray[3]; myarray[4] = -29; You can iterate over array elements: int sum = 0; for (int i = 0; i < 7; i++) { sum = sum + myarray[i]; Remember, indices start at zero May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 48
49 Quiz If we have the array declaration unsigned byte x[10]; what are valid ways to iterate over the array? a) for (int i=0; i < 10; i++) Serial.println(x[i]); b) for (int i=0; i <= 10; i++) Serial.println(x[i]); c) for (int i=10; i > 10; i--) Serial.println(x[i]); d) for (int i=9; i >= 0; i--) Serial.println(x[i]); May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 49
50 Warning The compiler will not tell you what went wrong! unsigned byte x[10]; for (int i = 1; i <= 10; i++) Serial.println(x[i]); It will just happily read whatever is in memory after the array, whether it makes sense to or not. If it doesn t make sense, your program may crash without warning or error message. May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 50
51 Multidimensional arrays in C Arrays can be multidimensional e.g. int cube[4][4][4]; myarr[3][0][0] myarr[3][0][1] myarr[3][0][2] myarr[3][0][3] myarr[2][0][0] myarr[3][1][0] myarr[2][0][1] myarr[3][1][1] myarr[2][0][2] myarr[3][1][2] myarr[2][0][3] myarr[3][1][3] myarr[1][0][0] myarr[2][1][0] myarr[3][2][0] myarr[1][0][1] myarr[2][1][1] myarr[3][2][1] myarr[1][0][2] myarr[2][1][2] myarr[3][2][2] myarr[1][0][3] myarr[2][1][3] myarr[3][2][3] myarr[2][2][0] myarr[3][3][0] myarr[2][2][1] myarr[3][3][1] myarr[2][2][2] myarr[3][3][2] myarr[2][2][3] myarr[3][3][3] myarr[0][0][0] myarr[1][1][0] myarr[0][0][1] myarr[1][1][1] myarr[0][0][2] myarr[1][1][2] myarr[0][0][3] myarr[1][1][3] myarr[0][1][0] myarr[1][2][0] myarr[2][3][0] myarr[0][1][1] myarr[1][2][1] myarr[2][3][1] myarr[0][1][2] myarr[1][2][2] myarr[2][3][2] myarr[0][1][3] myarr[1][2][3] myarr[2][3][3] myarr[0][2][0] myarr[1][3][0] myarr[0][2][1] myarr[1][3][1] myarr[0][2][2] myarr[1][3][2] myarr[0][2][3] myarr[1][3][3] myarr[0][3][0] myarr[0][3][1] myarr[0][3][2] myarr[0][3][3] May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 51
52 Multidimensional arrays in C You access elements with multiple []: cube[2][0][1] = 1; You iterate using nested loops: int sum = 0; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { for (int k = 0; k < 4; k++) { sum = sum + cube[i][j][k]; May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 52
Which 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 informationWhich LED(s) turn on? May 12, 2017 ENGR 40M Spring 2017 C.Z. Lee, J. Plummer, R. Howe 1
Which LED(s) turn on? May 12, 2017 ENGR 40M Spring 2017 C.Z. Lee, J. Plummer, R. Howe 1 Lab 3b Programming the LED cube ENGR 40M Chuan-Zheng Lee Stanford University 12 May 2017 Overview Goal: To write
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 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 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 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 informationLecture 12. Building an LED Display
Lecture 12 Building an LED Display Copyright 2017 by Mark Horowitz 1 By the End of Lecture, You Should Be Able To: Use LEDs in simple circuits Use time division multiplexing to control LEDs Control n 2
More informationRobotics 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 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 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 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 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 informationComputer Programming: C++
The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2003 Muath i.alnabris Computer Programming: C++ Experiment #7 Arrays Part II Passing Array to a Function
More informationMICROPROCESSORS A (17.383) Fall Lecture Outline
MICROPROCESSORS A (17.383) Fall 2010 Lecture Outline Class # 04 September 28, 2010 Dohn Bowden 1 Today s Lecture Syllabus review Microcontroller Hardware and/or Interface Programming/Software Lab Homework
More informationE40M. Binary Numbers, Codes. M. Horowitz, J. Plummer, R. Howe 1
E40M Binary Numbers, Codes M. Horowitz, J. Plummer, R. Howe 1 Reading Chapter 5 in the reader A&L 5.6 M. Horowitz, J. Plummer, R. Howe 2 Useless Box Lab Project #2 Adding a computer to the Useless Box
More informationSPDM 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 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 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 informationTANGIBLE 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 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 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 informationCourse materials and schedule are at. This file:
Physics 364, Fall 2014, Lab #22 Name: (Arduino 3: Serial data and digital feedback written by Zoey!) Monday, November 17 (section 401); Tuesday, November 18 (section 402) Course materials and schedule
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 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 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 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 informationCOSC 2P95. Procedural Abstraction. Week 3. Brock University. Brock University (Week 3) Procedural Abstraction 1 / 26
COSC 2P95 Procedural Abstraction Week 3 Brock University Brock University (Week 3) Procedural Abstraction 1 / 26 Procedural Abstraction We ve already discussed how to arrange complex sets of actions (e.g.
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 informationAssignment 1: grid. Due November 20, 11:59 PM Introduction
CS106L Fall 2008 Handout #19 November 5, 2008 Assignment 1: grid Due November 20, 11:59 PM Introduction The STL container classes encompass a wide selection of associative and sequence containers. However,
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 informationSWITCH 10 KILOHM RESISTOR 220 OHM RESISTOR POTENTIOMETER LCD SCREEN INGREDIENTS
11 SWITCH 10 KILOHM RESISTOR 220 OHM RESISTOR POTENTIOMETER LCD SCREEN INGREDIENTS 115 CRYSTAL BALL CREATE A CRYSTAL BALL TO TELL YOUR FUTURE Discover: LCD displays, switch/case statements, random() Time:
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 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 informationNote. 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 informationMemory and Pointers written by Cathy Saxton
Memory and Pointers written by Cathy Saxton Basic Memory Layout When a program is running, there are three main chunks of memory that it is using: A program code area where the program itself is loaded.
More informationENGR 40M Project 4b: Displaying ECG waveforms. Lab is due Monday June 4, 11:59pm
ENGR 40M Project 4b: Displaying ECG waveforms Lab is due Monday June 4, 11:59pm 1 Introduction Last week, you built a circuit that amplified a small 1Hz simulated heartbeat signal. In this week s you will
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 informationC:\Users\Jacob Christ\Documents\MtSAC\ELEC74 Mt SAC - chipkit\homework Sheets.docx
ELEC 74 Worksheet 1 Logic Gate Review 1. Draw the truth table and schematic symbol for: a. An AND gate b. An OR gate c. An XOR gate d. A NOT gate ELEC74 Worksheet 2 (Number Systems) 1. Convert the following
More informationMICROPROCESSORS A (17.383) Fall Lecture Outline
MICROPROCESSORS A (17.383) Fall 2010 Lecture Outline Class # 03 September 21, 2010 Dohn Bowden 1 Today s Lecture Syllabus review Microcontroller Hardware and/or Interface Programming/Software Lab Homework
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 informationArrays and functions Multidimensional arrays Sorting and algorithm efficiency
Introduction Fundamentals Declaring arrays Indexing arrays Initializing arrays Arrays and functions Multidimensional arrays Sorting and algorithm efficiency An array is a sequence of values of the same
More informationE40M. An Introduction to Making: What is EE?
E40M An Introduction to Making: What is EE? Jim Plummer Stanford University plummer@stanford.edu Chuan-Zheng Lee Stanford University czlee@stanford.edu Roger Howe Stanford University rthowe@stanford.edu
More informationCS 240 Data Structure Spring 2018 Exam I 03/01/2018
CS 240 Data Structure Spring 2018 Exam I 03/01/2018 This exam contains three section A) Code: (basic data type, pointer, ADT) a. Reading: Trace the code to predict the output of the code b. Filling: Fill
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 informationCMSC 201 Fall 2018 Lab 04 While Loops
CMSC 201 Fall 2018 Lab 04 While Loops Assignment: Lab 04 While Loops Due Date: During discussion, September 24 th through September 27 th Value: 10 points (8 points during lab, 2 points for Pre Lab quiz)
More informationCS536 Spring 2011 FINAL ID: Page 2 of 11
CS536 Spring 2011 FINAL ID: Page 2 of 11 Question 2. (30 POINTS) Consider adding forward function declarations to the Little language. A forward function declaration is a function header (including its
More informationOutline for Today. Lab Equipment & Procedures. Teaching Assistants. Announcements
Announcements Homework #2 (due before class) submit file on LMS. Submit a soft copy using LMS, everybody individually. Log onto the course LMS site Online Assignments Homework 2 Upload your corrected HW2-vn.c
More informationMore loops Ch
More loops Ch 3.3-3.4 Announcements Quiz next week! -Covers up to (and including) HW1 (week 1-3) -Topics: cout/cin, types, scope, if/else, etc. Review: Loops We put a loop around code that we want to run
More informationSTUDENT OUTLINE. Lesson 8: Structured Programming, Control Structures, if-else Statements, Pseudocode
STUDENT OUTLINE Lesson 8: Structured Programming, Control Structures, if- Statements, Pseudocode INTRODUCTION: This lesson is the first of four covering the standard control structures of a high-level
More informationCISC220 Lab 2: Due Wed, Sep 26 at Midnight (110 pts)
CISC220 Lab 2: Due Wed, Sep 26 at Midnight (110 pts) For this lab you may work with a partner, or you may choose to work alone. If you choose to work with a partner, you are still responsible for the lab
More informationE85: Digital Design and Computer Engineering Lab 1: Electrical Characteristics of Logic Gates
E85: Digital Design and Computer Engineering Lab 1: Electrical Characteristics of Logic Gates Objective The purpose of this lab is to become comfortable with logic gates as physical objects, to interpret
More informationECE 2036 Lab 4 Setup and Test mbed I/O Hardware Check-Off Deadline: Thursday, March 17, Name:
ECE 2036 Lab 4 Setup and Test mbed I/O Hardware Check-Off Deadline: Thursday, March 17, 2016 Name: Item Part 1. (40%) Color LCD Hello World Part 2. (10%) Timer display on Color LCD Part 3. (25%) Temperature
More informationWhy embedded systems?
MSP430 Intro Why embedded systems? Big bang-for-the-buck by adding some intelligence to systems. Embedded Systems are ubiquitous. Embedded Systems more common as prices drop, and power decreases. Which
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 informationIntro. Scheme Basics. scm> 5 5. scm>
Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if
More informationSlide Set 1. for ENCM 339 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary
Slide Set 1 for ENCM 339 Fall 2016 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary September 2016 ENCM 339 Fall 2016 Slide Set 1 slide 2/43
More informationCSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch
CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch Purpose: We will take a look at programming this week using a language called Scratch. Scratch is a programming language that was developed
More informationIntro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming
Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals
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 informationQUIZ. Source:
QUIZ Source: http://stackoverflow.com/questions/17349387/scope-of-macros-in-c Ch. 4: Data Abstraction The only way to get massive increases in productivity is to leverage off other people s code. That
More informationE40M Useless Box, Boolean Logic. M. Horowitz, J. Plummer, R. Howe 1
E40M Useless Box, Boolean Logic M. Horowitz, J. Plummer, R. Howe 1 Useless Box Lab Project #2a Motor Battery pack Two switches The one you switch A limit switch The first version of the box you will build
More informationExcel Basics: Working with Spreadsheets
Excel Basics: Working with Spreadsheets E 890 / 1 Unravel the Mysteries of Cells, Rows, Ranges, Formulas and More Spreadsheets are all about numbers: they help us keep track of figures and make calculations.
More informationPre-Lab: Part 1 Using The Development Environment. Purpose: Minimum Parts Required: References: Handouts:
Purpose: Minimum Parts Required: References: Handouts: Laboratory Assignment Number 1 for Mech 143/ELEN123 Due by 5:00pm in lab box on Friday, April 19, 2002 Pre-Lab due by 5:00pm in lab box on Tuesday,
More informationECE 375: Computer Organization and Assembly Language Programming
ECE 375: Computer Organization and Assembly Language Programming SECTION OVERVIEW Lab 5 Large Number Arithmetic Complete the following objectives: ˆ Understand and use arithmetic/alu instructions. ˆ Manipulate
More informationCS 31: Intro to Systems Operating Systems Overview. Kevin Webb Swarthmore College November 8, 2018
CS 31: Intro to Systems Operating Systems Overview Kevin Webb Swarthmore College November 8, 2018 Reading Quiz Big Picture Goals is an extra code layer between user programs and hardware. Goal: Make life
More informationCSCI-1200 Data Structures Spring 2018 Lecture 14 Associative Containers (Maps), Part 1 (and Problem Solving Too)
CSCI-1200 Data Structures Spring 2018 Lecture 14 Associative Containers (Maps), Part 1 (and Problem Solving Too) HW6 NOTE: Do not use the STL map or STL pair for HW6. (It s okay to use them for the contest.)
More informationLDR_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 informationAnnouncements Homework #3 due today. Ports. Outline for Today C8051 SFRs & Port I/O Worksheet #4 - simple I/O code. Using Ports
Announcements Homework #3 due today Online LMS Assessment Everybody submits their own on LMS You should have a lab notebook by now You should have the Lab Manual by now Outline for Today C8051 SFRs & Port
More informationTouch Board User Guide. Introduction
Touch Board User Guide Introduction The Crazy Circuits Touch Board is a fun way to create interactive projects. The Touch Board has 11 built in Touch Points for use with projects and also features built
More informationCS31 Discussion 1E Spring 17 : week 08
CS31 Discussion 1E Spring 17 : week 08 TA: Bo-Jhang Ho bojhang@cs.ucla.edu Credit to former TA Chelsea Ju Project 5 - Map cipher to crib Approach 1: For each pair of positions, check two letters in cipher
More informationLecture Transcript While and Do While Statements in C++
Lecture Transcript While and Do While Statements in C++ Hello and welcome back. In this lecture we are going to look at the while and do...while iteration statements in C++. Here is a quick recap of some
More informationLDR_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 informationNumerical Computing in C and C++ Jamie Griffin. Semester A 2017 Lecture 2
Numerical Computing in C and C++ Jamie Griffin Semester A 2017 Lecture 2 Visual Studio in QM PC rooms Microsoft Visual Studio Community 2015. Bancroft Building 1.15a; Queen s W207, EB7; Engineering W128.D.
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 information5. Control Statements
5. Control Statements This section of the course will introduce you to the major control statements in C++. These control statements are used to specify the branching in an algorithm/recipe. Control statements
More informationProcedures, Parameters, Values and Variables. Steven R. Bagley
Procedures, Parameters, Values and Variables Steven R. Bagley Recap A Program is a sequence of statements (instructions) Statements executed one-by-one in order Unless it is changed by the programmer e.g.
More informationMagic 8 Ball. Student's name & ID (1): Partner's name & ID (2): Your Section number & TA's name
MPS Magic 8 Ball Lab Exercise Magic 8 Ball Student's name & ID (1): Partner's name & ID (2): Your Section number & TA's name Notes: You must work on this assignment with your partner. Hand in a printer
More informationPointers in C/C++ 1 Memory Addresses 2
Pointers in C/C++ Contents 1 Memory Addresses 2 2 Pointers and Indirection 3 2.1 The & and * Operators.............................................. 4 2.2 A Comment on Types - Muy Importante!...................................
More informationExcel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller
Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller Table of Contents Introduction!... 1 Part 1: Entering Data!... 2 1.a: Typing!... 2 1.b: Editing
More informationObjectives: Learn how to input and output analogue values Be able to see what the Arduino is thinking by sending numbers to the screen
Objectives: Learn how to input and output analogue values Be able to see what the Arduino is thinking by sending numbers to the screen By the end of this session: You will know how to write a program to
More informationComputer Science & Engineering 150A Problem Solving Using Computers
Computer Science & Engineering 150A Problem Solving Using Computers Lecture 06 - Stephen Scott Adapted from Christopher M. Bourke 1 / 30 Fall 2009 Chapter 8 8.1 Declaring and 8.2 Array Subscripts 8.3 Using
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 informationCS/EE 3710 Computer Architecture Lab Checkpoint #2 Datapath Infrastructure
CS/EE 3710 Computer Architecture Lab Checkpoint #2 Datapath Infrastructure Overview In order to complete the datapath for your insert-name-here machine, the register file and ALU that you designed in checkpoint
More informationQUIZ. What are 3 differences between C and C++ const variables?
QUIZ What are 3 differences between C and C++ const variables? Solution QUIZ Source: http://stackoverflow.com/questions/17349387/scope-of-macros-in-c Solution The C/C++ preprocessor substitutes mechanically,
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 informationProgramming with Arrays Intro to Pointers CS 16: Solving Problems with Computers I Lecture #11
Programming with Arrays Intro to Pointers CS 16: Solving Problems with Computers I Lecture #11 Ziad Matni Dept. of Computer Science, UCSB Thursday, 5/17 in this classroom Starts at 2:00 PM **SHARP** Please
More informationa) Write the signed (two s complement) binary number in decimal: b) Write the unsigned binary number in hexadecimal:
CS107 Autumn 2018 CS107 Midterm Practice Problems Cynthia Lee Problem 1: Integer Representation There is a small amount of scratch space between problems for you to write your work, but it is not necessary
More informationAdding content to your Blackboard 9.1 class
Adding content to your Blackboard 9.1 class There are quite a few options listed when you click the Build Content button in your class, but you ll probably only use a couple of them most of the time. Note
More informationFigure 1: Pushbutton without Pull-up.
Chapter 7: Using the I/O pins as Inputs. In addition to working as outputs and being able to turn the I/O pins on and off, these same pins can be used as inputs. In this mode the PIC is able to determine
More informationThe Dynamic Typing Interlude
CHAPTER 6 The Dynamic Typing Interlude In the prior chapter, we began exploring Python s core object types in depth with a look at Python numbers. We ll resume our object type tour in the next chapter,
More informationThis is the Arduino Uno: This is the Arduino motor shield: Digital pins (0-13) Ground Rail
Reacting to Sensors In this tutorial we will be going over how to program the Arduino to react to sensors. By the end of this workshop you will have an understanding of how to use sensors with the Arduino
More informationSpring 2017 Gabriel Kuri
Lab 2 ECE 431L Spring 2017 Gabriel Kuri This lab is made up of two parts. Part 1 will consist of familiarizing yourself with the Raspberry Pi (RPi). It includes running Unix/Linux commands to become somewhat
More informationStatements execute in sequence, one after the other, such as the following solution for a quadratic equation:
Control Structures Sequence Statements execute in sequence, one after the other, such as the following solution for a quadratic equation: double desc, x1, x2; desc = b * b 4 * a * c; desc = sqrt(desc);
More informationStation Automation --W3SZ
Station Automation --W3SZ Now Back to Previously Scheduled Program USB-Serial IF/Transverter Bandswitch Arduino-VHFLog Example I started with Ed Finn WA3DRC s excellent code that was written to give TS2000
More informationC++ for Java Programmers
Basics all Finished! Everything we have covered so far: Lecture 5 Operators Variables Arrays Null Terminated Strings Structs Functions 1 2 45 mins of pure fun Introduction Today: Pointers Pointers Even
More informationCS103 Handout 29 Winter 2018 February 9, 2018 Inductive Proofwriting Checklist
CS103 Handout 29 Winter 2018 February 9, 2018 Inductive Proofwriting Checklist In Handout 28, the Guide to Inductive Proofs, we outlined a number of specifc issues and concepts to be mindful about when
More informationThese are notes for the third lecture; if statements and loops.
These are notes for the third lecture; if statements and loops. 1 Yeah, this is going to be the second slide in a lot of lectures. 2 - Dominant language for desktop application development - Most modern
More informationIntroduction to MATLABs Data Acquisition Toolbox, the USB DAQ, and accelerometers
Introduction to MATLABs Data Acquisition Toolbox, the USB DAQ, and accelerometers This week we will start to learn the software that we will use through the course, MATLAB s Data Acquisition Toolbox. This
More informationControl Flow. COMS W1007 Introduction to Computer Science. Christopher Conway 3 June 2003
Control Flow COMS W1007 Introduction to Computer Science Christopher Conway 3 June 2003 Overflow from Last Time: Why Types? Assembly code is typeless. You can take any 32 bits in memory, say this is an
More informationWelcome! COMP s1. Programming Fundamentals
Welcome! 0 COMP1511 18s1 Programming Fundamentals COMP1511 18s1 Lecture 6 1 Loops + Arrays Andrew Bennett loops inside loops stopping loops arrays 2 Before we begin introduce
More information