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.

Slides:



Advertisements
Similar presentations
Wireless Cue Light Project
Advertisements

Khaled A. Al-Utaibi Interfacing an LED The Light Emitting Diode (LED) Applications DC Characteristics & Operation Interfacing to.
EMS1EP Lecture 4 Intro to Programming Dr. Robert Ross.
ARDUINO CLUB What we’re really doing. BASICS The setup() and loop() functions.
Electrical team Arduino tutorial I BY: JOSHUA arduini
Lab7: Introduction to Arduino
Anurag Dwivedi & Rudra Pratap Suman.  Open Source electronic prototyping platform based on flexible easy to use hardware and software.
Digital & Analog Inputs. Review Fundamental parts of an Arduino program are … Setting output types using pinMode. Declaring variables Can write a digital.
ELCT 201 week 13 Analog ON/OFF control system conversion to Digital ON/OFF control system.
ArTe Arduino Letizia Jaccheri Pisa February 2010.
Finish your programs from last week STOPLIGHT CIRCUIT! You may need … – int – void setup() – void loop() – pinMode – digitalWrite – delay.
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.
ARDUINO PROGRAMMING Working with the Arduino microcontroller.
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
chipKit Sense Switch & Control LED
Programming Hexors on Arduino Uno. Arduino Uno Arduino is an open-source electronics platform based on easy- to-use hardware and software. It's intended.
Arduino. What is it? A open-source software suite and single-board microcontroller. Allows easy and affordable prototyping of microcontroller applications.
Tweaking Your Simon Adding a photoresistor and changing code Instruction by Pete Lewis and Linz Craig.
Good LED Circuit 5V0 GND. What Voltage Does Meter See? Answer: 5 V.
LECTURE 2 – INPUTS THIS LECTURE WILL INTRODUCE HOW TO INPUT SIGNALS INTO AN ARDUINO.
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.
Code The Arduino Environment.
ARDUINO 1. Basics  Comments  /* * Blink * * The basic Arduino example. Turns on an LED on for one second, * then off for one second, and so on... We.
Microcontrollers, Microcomputers, and Microprocessors
Arduino libraries Datatekniker Udvidet hardware/software.
INTERNET OF EVERYTHING SDU 2016 Week 4. Simple Digital and Analog Inputs  The Arduino’s ability to sense digital and analog inputs allows it to respond.
Photoresistor resistance changes dramatically with light level living with the lab Using Photoresistors with an Arduino © 2011 LWTL faculty team.
C# SERIAL COMMUNICATION TEMPERATURE CONTROL WITH ARDUINO KAAN EREN
Microcontroller basics Embedded systems for mortals.
Microcontroller basics Embedded systems for mortals.
1 Introduction to Haptics Introduction to the Hapkit board Allison M. Okamura Stanford University.
Robotics Grant Agreement No LLP UK-LEONARDO-LMP Project acronym: CLEM Project title: Cloud services for E-Learning in Mechatronics Technology.
Programming in Arduino Materials:Arduino Board Casperelectronics Pre Pres. Notes Photos from workshop?
Introduction to Arduino A very basic intro to Arduino, the IDE and the Servos class.
Atmega328p Introduction for Digital and PWM Output Brion L Fuller II Robotics Club.
Arduino + Bluetooth TYWu. Connection Arduino + Bluetooth Module.
:Blink Blink: Er. Sahil Khanna
Arduino “Getting Started” Instructor : Dr Matthew Miss Khin Yi Kyaw
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.
Getting Started: Building & Programming
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
Assist. Prof. Rassim Suliyev - SDU 2017
Microcontroller basics
Val Manes Department of Math & Computer Science
Microcontroller basics
Wireless Cue Light Project
UTA010 : Engineering Design – II
Welcome to Arduino A Microcontroller.
Get Your Project Started with Arduino
UCD ElecSoc Robotics Club 2017/2018
INC 161 , CPE 100 Computer Programming
Arduino.
Introduction to Arduino Microcontrollers
IoT Programming the Particle Photon.
Arduino 101 Credit(s):
1 Code
Working with Arduino: Lesson #1: Getting Acquainted with the Kit
CS-4540 Robotics - Lab 05 Switch inputs to the Arduino Uno
Welcome to Digital Electronics using the Arduino Board
Programming 2: The Arduino IDE & First Sketches
CTY SAR FCPS Shawn Lupoli, Elliot Tan
Aeroponic Engineering and Vertical Farming
Lab #1: Getting Started.
Arduino Uno circuit basics
Setting up a basic program with Arduino
Introduction to Arduinos
SAURABH GINGADE.
Arduino程式範例.
Introduction to Arduino IDE and Software
Interrupts.
Presentation transcript:

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 describe any object to the drawer only using geometrical terms. – Demo

Recap Instructions need to be specific. A computer does everything you tell it to, but only what you tell it to do.

Computer Programming 101 Computer programs are written in a language that a computer can understand. – I have five apples. – apples = 5; You can also use mathematical operators with computers. – I have 10 total pieces of fruit, 6 apples, and 4 oranges. apples = 6; oranges = 4; fruit = apples + oranges; There are rules in both language and programming that must be followed in order to be understood. Computers take everything literally.

Arduinos

Turn on an LED int ledPin = 13; // LED connected to digital // pin 13 void setup() { // initialize the digital pin as an output: pinMode(ledPin, OUTPUT); } // the loop() function runs over and over again, // as long as the Arduino has power void loop() { digitalWrite(ledPin, HIGH); // set the LED on } 1.Define all of your variables – Later, when we write ‘ledPin’, we really mean 13. – 13 is an integer, so we have to tell the computer “int” 2.Use the setup function – Have to write “void” before it, because the Arduino doesn’t send a message back to us after it completes the task – Define WHICH pin we will use – SEND INFORMATION = OUTPUT 3.Put the instructions inside a loop, so the computer repeats 4.Tell the LED to turn on – use function digitalWrite – set the pin (which pin??) to HIGH

Grammar - What did you notice? Each statement ends in a semicolon – int ledPin = 13; If a statement starts with ‘//’, the computer program won’t notice it! – // set the LED on – Comments are used in programs to explain what it does – in English Each FUNCTION has brackets around it { } loop() { digitalWrite(ledPin, HIGH); // set the LED on }

Key Functions setup() The setup() function is called when a sketch starts. Use it to initialize variables, pin modes, start using libraries, etc. The setup function will only run once, after each powerup or reset of the Arduino board. Example: int buttonPin = 3; int ledPin = 13; void setup() { pinMode(buttonPin, INPUT); pinMode(ledPin,OUTPUT); }

Key Functions loop() – After creating a setup() function, which initializes and sets the initial values, the loop() function does precisely what its name suggests, and loops consecutively, allowing your program to change and respond. Use it to actively control the Arduino board. delay(number_of_ms) – Pauses for the amount of time specified. Example: loop(){ digitalWrite(ledPin,HIGH); delay(1000); digitalWrite(ledPin,LOW); delay(1000); }

Practice Design a stoplight controller that will sequentially turn on 3 LEDs (Green, Yellow, Red). Choose appropriate delays so that the lights are each on for the proper portion of time during the cycle. Remember to connect the LEDs through a resistor (250 – 1000 Ω) from the output pin to ground.