Which LED(s) turn on?
|
|
- Rudolf Douglas
- 5 years ago
- Views:
Transcription
1 Go to and use the code 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 Announcements Prelab 3b is due next week Lab 2b and 3a are due next week Midterm exam has been graded Solutions will be posted after class Homework 4 out tonight Lab 3x: Prelab due for Sunday. If you signed up you will get an from me tonight Your Lab 2b is still due before your section next week May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 3
4 Midterm Statistics Median: 83.0 Mean: Std Dev: Midterm Exam Scores frequency scores Solutions & grades will be released after class Regrade requests on Gradescope (1 week) May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 4
5 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 5
6 Decomposition loop() The main Arduino loop calls display() Does one pass through the LEDs (time-division multiplexing) which calls Looks up the LED state getledstate() associated with an anode/cathode pair May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 6
7 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 7
8 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 (", $) to (&, ', () return pattern[z][y][x]; May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 8
9 Review: Pin multiplexing anode (+) wires cathode ( ) wires May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 9
10 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 10
11 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 11
12 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 (", $) to (&, ', () return pattern[z][y][x]; May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 12
13 Mapping between 2-D and 3-D May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 13
14 Mapping between 2-D and 3-D We want a function that maps from anode/cathode pairs ", $ (e.g. D6 ) to 3D coordinates &, ', ( May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 14
15 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 15
16 Mapping between 2-D and 3-D May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 16
17 Mapping between 2-D and 3-D May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 17
18 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 18
19 Decomposition loop() The main Arduino loop calls display() Does one pass through the LEDs (time-division multiplexing) which calls Looks up the LED state getledstate() associated with an anode/cathode pair May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 19
20 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 20
21 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 21
22 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 22
23 Planning your breadboard May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 23
24 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 24
25 Breadboard style Please don t: May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 25
26 Planning your breadboard May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 26
27 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 27
28 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 28
29 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 29
30 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 30
31 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 31
32 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 32
33 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 33
34 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 34
35 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 35
36 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 36
37 frequency response E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 37
38 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 38
39 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 39
40 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 40
41 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 41
42 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 42
43 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 43
44 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 44
45 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); // updates pattern if (digitalread(button) == HIGH) running =!running; delay(1000); May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 45
46 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 46
47 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 47
48 Programming Review Arrays in C
49 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 49
50 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 50
51 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 51
52 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 52
53 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 53
54 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 54
Which 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 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 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. 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 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 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 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 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 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 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 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 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 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 informationExceptions in Java
Exceptions in Java 3-10-2005 Opening Discussion Do you have any questions about the quiz? What did we talk about last class? Do you have any code to show? Do you have any questions about the assignment?
More informationDiscussion 1H Notes (Week 3, April 14) TA: Brian Choi Section Webpage:
Discussion 1H Notes (Week 3, April 14) TA: Brian Choi (schoi@cs.ucla.edu) Section Webpage: http://www.cs.ucla.edu/~schoi/cs31 More on Arithmetic Expressions The following two are equivalent:! x = x + 5;
More informationIntroduction to Computer Science Midterm 3 Fall, Points
Introduction to Computer Science Fall, 2001 100 Points Notes 1. Tear off this sheet and use it to keep your answers covered at all times. 2. Turn the exam over and write your name next to the staple. Do
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 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 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 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 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 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 informationCIS220 In Class/Lab 1: Due Sunday night at midnight. Submit all files through Canvas (25 pts)
CIS220 In Class/Lab 1: Due Sunday night at midnight. Submit all files through Canvas (25 pts) Problem 0: Install Eclipse + CDT (or, as an alternative, Netbeans). Follow the instructions on my web site.
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 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 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 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 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 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 informationWelcome to... CS113: Introduction to C
Welcome to... CS113: Introduction to C Instructor: Erik Sherwood E-mail: wes28@cs.cornell.edu Course Website: http://www.cs.cornell.edu/courses/cs113/2005fa/ The website is linked to from the courses page
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 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 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 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 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 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 informationLab 6 Vectors and functions
CMSC160 Intro to Algorithmic Design Blaheta Lab 6 Vectors and functions 11 October 2016 The drill for this lab is another part of the Chapter 4 drill. Come to lab on Tuesday either with it completed or
More informationComputer Science II Lecture 1 Introduction and Background
Computer Science II Lecture 1 Introduction and Background Discussion of Syllabus Instructor, TAs, office hours Course web site, http://www.cs.rpi.edu/courses/fall04/cs2, will be up soon Course emphasis,
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 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 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 informationMore on Arrays CS 16: Solving Problems with Computers I Lecture #13
More on Arrays CS 16: Solving Problems with Computers I Lecture #13 Ziad Matni Dept. of Computer Science, UCSB Announcements Homework #12 due today No homework assigned today!! Lab #7 is due on Monday,
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 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 informationBy the end of Class. Outline. Homework 5. C8051F020 Block Diagram (pg 18) Pseudo-code for Lab 1-2 due as part of prelab
By the end of Class Pseudo-code for Lab 1-2 due as part of prelab Homework #5 on website due before next class Outline Introduce Lab 1-2 Counting Timers on C8051 Interrupts Laboratory Worksheet #05 Copy
More informationCSCI-1200 Data Structures Spring 2014 Lecture 5 Pointers, Arrays, Pointer Arithmetic
CSCI-1200 Data Structures Spring 2014 Lecture 5 Pointers, Arrays, Pointer Arithmetic Announcements: Test 1 Information Test 1 will be held Monday, February 10th, 2014 from 6-7:50pm, Lab sections 1-5 and
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 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 informationE40M. Solving Circuits using Nodal Analysis, Part II and EveryCircuit TM. M. Horowitz, J. Plummer, R. Howe 1
E40M Solving Circuits using Nodal Analysis, Part II and EveryCircuit TM M. Horowitz, J. Plummer, R. Howe 1 The Key Idea from Last Lecture Systematic Nodal Analysis 1. Label all the nodes (V A, V B, or
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 informationArrays 2 CS 16: Solving Problems with Computers I Lecture #12
Arrays 2 CS 16: Solving Problems with Computers I Lecture #12 Ziad Matni Dept. of Computer Science, UCSB Material: Post- Midterm #1 Lecture 7 thru 12 Homework, Labs, Lectures, Textbook Tuesday, 11/14 in
More informationCSCI-1200 Data Structures Spring 2018 Lecture 5 Pointers, Arrays, & Pointer Arithmetic
CSCI-1200 Data Structures Spring 2018 Lecture 5 Pointers, Arrays, & Pointer Arithmetic Announcements: Test 1 Information Test 1 will be held Monday, February 5th, 2017 from 6-7:50pm Students will be randomly
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 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 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 informationCSCE 206: Structured Programming in C++
CSCE 206: Structured Programming in C++ 2017 Spring Exam 2 Monday, March 20, 2017 Total - 100 Points B Instructions: Total of 13 pages, including this cover and the last page. Before starting the exam,
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 informationE40M. Solving Circuits using Nodal Analysis and EveryCircuit TM. M. Horowitz, J. Plummer, R. Howe 1
E40M Solving Circuits using Nodal Analysis and EveryCircuit TM M. Horowitz, J. Plummer, R. Howe 1 How Do We Figure Out the Voltages and Currents? Diode Solar Cell Li Bat Volt Conv R In this set of lecture
More informationCprE 288 Introduction to Embedded Systems Exam 1 Review. 1
CprE 288 Introduction to Embedded Systems Exam 1 Review http://class.ece.iastate.edu/cpre288 1 Overview of Today s Lecture Announcements Exam 1 Review http://class.ece.iastate.edu/cpre288 2 Announcements
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 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 informationEE251: Thursday September 20
EE251: Thursday September 20 Parallel I/O aka General Purpose I/O aka GPIO Common Devices: Switches, LEDs, Keypads Read Lab 4 carefully, and Chapter 14 in text Think about what you would like to review
More informationECE 122 Engineering Problem Solving with Java
ECE 122 Engineering Problem Solving with Java Introduction to Programming for ECE Lecture 1 Course Overview Welcome! What is this class about? Java programming somewhat software somewhat Solving engineering
More informationArrays (& strings) Ch 7
Arrays (& strings) Ch 7 Announcements Quiz scores on gradescope Test next week (whole class period) Highlights - arrays - 2D arrays - string functions - arrays and functions string We have been using strings
More informationCS Introduction to Programming Midterm Exam #1 - Prof. Reed Fall 2009
CS 102 - Introduction to Programming Midterm Exam #1 - Prof. Reed Fall 2009 What is your name?: There are two sections: I. True/False..................... 60 points; ( 30 questions, 2 points each) II.
More informationCS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG
CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG 1 Notice Reading Assignment Chapter 1: Introduction to Java Programming Homework 1 It is due this coming Sunday
More informationEECS 270 Midterm Exam
EECS 270 Midterm Exam Fall 2009 Name: unique name: Sign the honor code: I have neither given nor received aid on this exam nor observed anyone else doing so. Scores: NOTES: Problem # Points 1 /11 2 /4
More informationM. Horowitz E40M Lecture 13
http://applecorp.avature.net/ursite? projectid=7260&source=ur+site+ Portal&tags=stanford%7Cfall_2017 %7Cstanford_university_fall_2017_ careers_in_hardware_and_silicon_ panel%7crsvp 1 Lecture 13 Driving
More informationFunction Calling Conventions 2 CS 64: Computer Organization and Design Logic Lecture #10
Function Calling Conventions 2 CS 64: Computer Organization and Design Logic Lecture #10 Ziad Matni Dept. of Computer Science, UCSB Lecture Outline More on MIPS Calling Convention Functions calling functions
More informationCSCI-1200 Data Structures Fall 2018 Lecture 5 Pointers, Arrays, & Pointer Arithmetic
CSCI-1200 Data Structures Fall 2018 Lecture 5 Pointers, Arrays, & Pointer Arithmetic Announcements: Test 1 Information Test 1 will be held Thursday, Sept 20th, 2018 from 6-7:50pm Students will be randomly
More informationCSCE 145 Exam 1 Review. This exam totals to 100 points. Follow the instructions. Good luck!
CSCE 145 Exam 1 Review This exam totals to 100 points. Follow the instructions. Good luck! Chapter 1 This chapter was mostly terms so expect a fill in the blank style questions on definition. Remember
More informationCSCI-1200 Data Structures Spring 2017 Lecture 5 Pointers, Arrays, Pointer Arithmetic
CSCI-1200 Data Structures Spring 2017 Lecture 5 Pointers, Arrays, Pointer Arithmetic Announcements Submitty iclicker registration is still open. Even if you already registered on the iclicker website,
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 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 informationInformation Science 1
Information Science 1 Fundamental Programming Constructs (1) Week 11 College of Information Science and Engineering Ritsumeikan University Topics covered l Terms and concepts from Week 10 l Flow of control
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 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 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 informationWinter 2018 March 12 th, 2018 CS106X Midterm Examination Solution
CS106X Handout 35S Winter 2018 March 12 th, 2018 CS106X Midterm Examination Solution Once again, your awesome course staff spent the week grading your exams, and I m happy to share that they re graded!
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 informationComp 151. Control structures.
Comp 151 Control structures. admin quiz this week believe it or not only 2 weeks from exam. one a week each week after that. idle debugger Debugger: program that will let you look at the program as it
More informationTips from the experts: How to waste a lot of time on this assignment
Com S 227 Spring 2018 Assignment 1 100 points Due Date: Friday, September 14, 11:59 pm (midnight) Late deadline (25% penalty): Monday, September 17, 11:59 pm General information This assignment is to be
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 informationCS 051 Homework Laboratory #2
CS 051 Homework Laboratory #2 Dirty Laundry Objective: To gain experience using conditionals. The Scenario. One thing many students have to figure out for the first time when they come to college is how
More informationHow Do We Figure Out the Voltages and Currents?
How Do We Figure Out the Voltages and Currents? Diode Solar Cell Li Bat Volt Conv R In this set of lecture notes we ll develop methods to analyze circuits. M. Horowitz, J. Plummer, R. Howe 2 Useless Box
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 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 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 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 informationCS Final Exam Review Suggestions - Spring 2014
CS 111 - Final Exam Review Suggestions p. 1 CS 111 - Final Exam Review Suggestions - Spring 2014 last modified: 2014-05-09 before lab You are responsible for material covered in class sessions, lab exercises,
More informationEK307 Lab: Microcontrollers
EK307 Lab: Microcontrollers Laboratory Goal: Program a microcontroller to perform a variety of digital tasks. Learning Objectives: Learn how to program and use the Atmega 323 microcontroller Suggested
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 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 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 information