Introduction 2 Smart Design. What is smart design? 2 Everything is designed except nature The packaging of a Band-Aid The curve of a bike frame The shape.

Slides:



Advertisements
Similar presentations
Control Structures.
Advertisements

Chapter 4 Computation Bjarne Stroustrup
EMS1EP Lecture 4 Intro to Programming Dr. Robert Ross.
VEX and Robot C Chris Patterson Presented by Modified by J. Andazola.
Introduction to C Programming
Introduction to C Programming
Digital & Analog Inputs. Review Fundamental parts of an Arduino program are … Setting output types using pinMode. Declaring variables Can write a digital.
Primitive Data Types There are a number of common objects we encounter and are treated specially by almost any programming language These are called basic.
Intro to Programming and Microcontrollers. Activity Group into pairs and sit back-to-back. Pick one person who is going to draw. The other person will.
 2007 Pearson Education, Inc. All rights reserved Introduction to C Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
Railway Foundation Electronic, Electrical and Processor Engineering.
Libraries Programs that other people write that help you. #include // enables C++ #include // enables human-readable text #include // enables math functions.
Introduction to C Programming
Railway Foundation Electronic, Electrical and Processor Engineering.
1 Introduction to Coding. 2 Example Codes A lot of example codes are given with Arduino IDE A code can often be based on a previous example rather than.
String Escape Sequences
Programming Concepts MIT - AITI. Variables l A variable is a name associated with a piece of data l Variables allow you to store and manipulate data in.
ARDUINO PROGRAMMING Working with the Arduino microcontroller.
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
1 Chapter Two Using Data. 2 Objectives Learn about variable types and how to declare variables Learn how to display variable values Learn about the integral.
What is RobotC?!?! Team 2425 Hydra. Overview What is RobotC What is RobotC used for What you need to program a robot How a robot program works Framework.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
ROBOTC Software Introduction. ROBOTC Software ROBOTC developed specifically for classrooms and competitions Complete programming solution for VEX Cortex.
chipKit Sense Switch & Control LED
True or False Unit 3 Lesson 7 Building Blocks of Decision Making With Additions & Modifications by Mr. Dave Clausen True or False.
CIS Computer Programming Logic
ProtoSnap Introduction to Arduino Casey Haskell, Pete Lewis, David Stillman, Jim Lindblom, Pete Dokter, Lindsay Levkoff, Trevor Zylstra.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 6 Decisions and Conditions.
More on Input Output Input Stream : A sequence of characters from an input device (like the keyboard) to the computer (the program running). Output Stream.
CPS120: Introduction to Computer Science Decision Making in Programs.
Selection (if-then-else) Programming Has 3 Types of Control: Sequential (normal): Control of Execution Proceeds One after the Other Selection (if-then-else):
What is a computer? A computer is a device that:
S2008Final_part1.ppt CS11 Introduction to Programming Final Exam Part 1 S A computer is a mechanical or electrical device which stores, retrieves,
Chapter 8 High-Level Programming Languages. 8-2 Chapter Goals Describe the translation process and distinguish between assembly, compilation, interpretation,
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 2 Chapter 2 - Introduction to C Programming.
Fundamental Programming: Fundamental Programming Introduction to C++
An Introduction to Java – Part 1 Dylan Boltz. What is Java?  An object-oriented programming language  Developed and released by Sun in 1995  Designed.
Lecture 4 Control Structures MIT – AITI What are Control Structures? Control structures are a way to alter the natural sequence of execution in.
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Selection Statements Selection Switch Conditional.
Chapter 3 - Structured Program Development Outline 3.1Introduction 3.2Algorithms 3.3Pseudocode 3.4Control Structures 3.5The If Selection Structure 3.6The.
Code The Arduino Environment.
8-1 Compilers Compiler A program that translates a high-level language program into machine code High-level languages provide a richer set of instructions.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 2 - Introduction to C Programming Outline.
CPS120: Introduction to Computer Science Decision Making in Programs.
Microcontrollers, Microcomputers, and Microprocessors
CPS120: Introduction to Computer Science Decision Making in Programs.
VEX and Robot C Chris Patterson Frisco ISD CTE Center Presented by.
1 Introduction to Haptics Introduction to the Hapkit board Allison M. Okamura Stanford University.
Introduction to Programming the Arduino Dr Gaw 3/21/14.
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
7 - Programming 7J, K, L, M, N, O – Handling Data.
INTRODUCTION TO ROBOTICS Part 5: Programming
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
CIS3931 – Intro to JAVA Lecture Note Set 2 17-May-05.
Val Manes Department of Math & Computer Science
Arduino & its hardware interfacing
Chapter 2 - Introduction to C Programming
CSC113: Computer Programming (Theory = 03, Lab = 01)
Chapter 2 - Introduction to C Programming
Lesson 2: Introduction to Control programming using Labview
Building Java Programs Chapter 2
Unit 2 Programming.
Arithmetic operations, decisions and looping
Working with Arduino: Lesson #1: Getting Acquainted with the Kit
Introduction to C++ Programming
Structured Program
While Loops and If-Else Structures
Understand the interaction between computer hardware and software
Presentation transcript:

Introduction 2 Smart Design

What is smart design? 2 Everything is designed except nature The packaging of a Band-Aid The curve of a bike frame The shape of a city street light Smart designs include a microprocessor (i.e. – a small computer) Logic gives the design “intelligence” Code is the language used

Arduino 3 Arduino’s are the baby of the desktop/laptop era Small portable computer (microprocessor + inputs/outputs) Programmed using Arduino Integrated Development Environment (IDE) Inputs (instead of mouse and keyboard) Buttons, flex sensors, etc. Outputs (instead of monitor and speakers) Motors, LEDs, etc.

SparkFun Inventor Kit 4 SparkFun Inventor Kit (SIK) compiles many components to interface with the Arduino Inputs produce voltages to be read by the Arduino Outputs are controlled using voltages produced by the Arduino Smart Design teaching tool!

Computer Code 5 LanguageCodeExamples Description NounsVariables Integers (int) Booleans (boolean) Letters (char) Variables hold data of certain types like numbers/arrays/letters VerbsStructures If, else, end For…end While…end Structures cause action. They can create loops, create switches, or define cases. Adjectives Comparison Operators Equal to (==) Less than (<) Greater than (<) Comparison operators describe variables in order to make logic based decisions Adverbs Arithmetic Operators Addition (+) Multiplication (*) Division (/) Arithmetic operators describe the action occurring between two variables PunctuationSyntax Semicolons (;) Brackets ({}) Parentheses () Syntax groups and separates code in discernible segments.

Variables 6 Variable = Noun Variables are the subject of the code (person/place/thing) Variables are distinguished by type Integers - int are whole numbers between [ ,32768] Boolean – boolean are either a true (1) or false (0) Letters – char are alphabet letters between [A-Z] Any many more – see ReferenceReference

Variables 7 Variables store information Write value to variable Read value from variable

Structures 8 Structures = Verbs Give the code motion/action Structures provide various actions For loops – repeats statements within loop for a certain number of times using a ‘counting’ variable If/else statements –tests to see if an equation is satisfied, then directs code to appropriate statements While loops – repeat statements within loop until condition is met

Structures 9 1.What is a for loop that you notice in your daily life? 2.What is an if/else statement that you notice in your daily life? QUIZ!

Structures 10 1.What is a for loop that you notice in your daily life? - Microwave 30second timer - Traffic lights turning green, then yellow, then red 2. What is an if/else statement that you notice in your daily life? - Alarm clock turning on at 6:26am - Street lights turning on at night Examples?

Comparison Operators 11 Comparison Operators = adjectives Describe variables by comparing to other values Comparison operators are mathematical inequality terms and return a boolean variable Equal to (==) – asks if two values are equal Not equal to (!=) – asks if two values are not equal Less/Greater than ( ) – asks if one variable is less/greater than another Any many more – see ReferenceReference

Arithmetic Operators 12 Arithmetic Operators = adverbs Describe the action occurring between two variables Arithmetic operators are mathematical operators between numeric variables Addition (+) – you know what this means… Multiplication (*) – you know what this means… Division (/) – you know what this means… Any many more – see ReferenceReference

Syntax 13 Syntax = punctuation Groups and separates code in discernible segments Syntax is required by computers in order to decipher the meaning of each line of code Semicolons (;) – ends a statement and will prevent complier errors Curly Braces ({}) – defines begin/end of various structures including for loops, if/else statements, and functions Parentheses () – many uses including defining order of operation in an equation, indicating arguments for a function, etc. Any many more – see ReferenceReference

Functions 14 Functions = paragraphs Short sequence of code with specific purpose/action Functions provide another method to organize code into discernible sections. Allows for easy reuse of code Commonly used functions digitalWrite() – write a HIGH or a LOW value to a digital pin (i.e. – output a voltage of 5V or 0V) analogRead() – read an analog signal and digitize using 10-bit analog to digital converter (i.e. – map input voltages [0-5V] to integers [0-1023] delay() – pauses the program for the specified amount of time Any many more – see Reference. Lots!!Reference

15 Color Code Variables Structures Comparison Operators Arithmetic Operators Syntax Functions Color code the following section of code so that all characters are colored QUIZ!

Open Ideas Reverse engineer a device that you use daily –Look up components, diagram how it works Diagram code for your favorite video game, cell phone application, etc. –Map the different inputs, logic, etc. 16