INC 161 , CPE 100 Computer Programming

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.
ARDUINO CLUB What we’re really doing. BASICS The setup() and loop() functions.
Lab7: Introduction to Arduino
Anurag Dwivedi & Rudra Pratap Suman.  Open Source electronic prototyping platform based on flexible easy to use hardware and software.
How to use Arduino By: Andrew Hoffmaster.
Embedded Sumo 1T4 – 1T5 UTRA.
Using the Arduino to Make an LED Flash Work in teams of two! living with the lab digital I/O pins (I/O = input / output) USB cable plug power pins.
Living with the lab Introduction to Arduino Programming arduino.cc Gerald Recktenwald Portland State University
Analog and Digital Measurements living with the lab 14 digital input / output pins 6 analog input pins © 2011 LWTL faculty team.
ARDUINO PROGRAMMING Working with the Arduino microcontroller.
Arduino John Marcoux Christopher Lesch Thomas Dodge Unless otherwise noted, all information and pictures came from:
Arduino Part 1 Topics: Microcontrollers Programming Basics: structure and variables Digital Output Analog to Digital Conversion.
Arduino Part 2 Topics: Serial Communication Programming Constructs: functions, loops and conditionals Digital Input.
Intro to the Arduino Topics: The Arduino Digital IO
Arduino. What is it? A open-source software suite and single-board microcontroller. Allows easy and affordable prototyping of microcontroller applications.
Introduction to the Arduino
Khaled A. Al-Utaibi  The Push Button  Interfacing Push Buttons to Arduino  Programming Digital Inputs  Working with “Bouncy”
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
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.
Arduino libraries Datatekniker Udvidet hardware/software.
Photoresistor resistance changes dramatically with light level living with the lab Using Photoresistors with an Arduino © 2011 LWTL faculty team.
ME 120: Arduino Programming Arduino Programming Part II ME 120 Mechanical and Materials Engineering Portland State University
Programming in Arduino Materials:Arduino Board Casperelectronics Pre Pres. Notes Photos from workshop?
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.
Arduino Programming. THE ARDUINO IS A MICROCONTROLLER – A LOW COST, LOW PERFORMANCE COMPUTER.
Arduino.
Arduino Part 1 Topics: Microcontrollers
Sparkfun Electronics ATtiny85 Arduino Quick Reference Sheet
Val Manes Department of Math & Computer Science
Microcontroller basics
Arduino & its hardware interfacing
Arduino Programming Part II
Microcontroller basics
UTA010 : Engineering Design – II
An Arduino Workshop A Microcontroller.
Welcome to Arduino A Microcontroller.
Get Your Project Started with Arduino
UCD ElecSoc Robotics Club 2017/2018
Arduino Part 1 Topics: Microcontrollers Programming Basics
Lecture 2-2: Arduino Programming
Arduino.
Въведение в Arduino.
Arduino Uno and sensors
Introduction to Arduino Microcontrollers
Introduction to Arduinos
Roller Coaster Design Project
ARDUINO     What is an Arduino? Features 14 Digital I/O pins 6 Analogue inputs 6 PWM pins USB serial 16MHz Clock speed 32KB Flash memory 2KB SRAM.
Schedule 8:00-11:00 Workshop: Arduino Fundamentals
Intro to the Arduino Topics: The Arduino Digital IO
using the Arduino to make LEDs flash
Working with Arduino: Lesson #1: Getting Acquainted with the Kit
analog and digital measurements
Arduino programs Arduino toolchain Cross-compilation Arduino sketches
Arduino : Introduction & Programming
Intro to the Arduino by Someet Singh
CTY SAR FCPS Shawn Lupoli, Elliot Tan
CTY SAR FCPS Shawn Lupoli, Elliot Tan
I/O Programming with Arduino
Aeroponic Engineering and Vertical Farming
Lab #1: Getting Started.
Arduino Uno circuit basics
Introduction to Arduinos
UNIT 1 First programs.
Arduino程式範例.
Introduction to Arduino IDE and Software
Presented By,  Mamata Yadav (BE Elex & Comm.) Vice R&D Coordinator(HW), PCRT  Payal Shah (BE Elex & Comm.)  Ananta Das (BE Elex & Comm.) R&D Team,PCRT.
Interrupts.
CTY SAR FCPS Alexander Velikanov
Presentation transcript:

INC 161 , CPE 100 Computer Programming Lab 12

PC Interface with the World Command

Arduino Embedded computer (small computer) designed for easy to use Based on C language More details at http://www.arduino.cc/

Our board Arduino Duemilanove Based on CPU Atmega328 Powered by Plug-in USB

Software Download at www.arduino.cc

Structure of Arduino Program void setup() { // Commands here will run only once } void loop() // Commands here will run repeatedly

Digital Output The board pins can be programmed to give out 0 or 1 logic. 0 = 0 volts 1 = 5 volts Setup pinMode(pin,mode) - Use to set mode OUTPUT Loop digitalWrite(pin,value) - Use to set the voltage

Practice Board LED Connected to D6 – D13 Switch connected to D2 D3 D14 D15

Digital Output Example 1 void setup() { pinMode(6, OUTPUT); } void loop() digitalWrite(6, HIGH); How can you set the light to on and off?

Delay Because the board can compute quite fast, we need to add a delay. Function delay(n_millisec) will pause for n milliseconds (n is the input of the function)

Digital Output Example 2 void setup() { pinMode(6, OUTPUT); } void loop() digitalWrite(6, HIGH); delay(1000); digitalWrite(6, LOW);

Task 1 Write a program of running lights from left to right continuously.

Serial Output The board can communicate messages via serial port. Use serial monitor to view the output. Setup Serial.begin(9600) - Initialize serial port with speed 9600 bps (default) Loop Serial.print(arg) Serial.println(arg) - Use to print

Serial Output Example 3 int a = 0; void setup() { Serial.begin(9600); } void loop() Serial.print(“Value = “); Serial.println(a); delay(1000); a++;

Digital Input The board can read the value of switch. Setup pinMode(pin,mode) - Use to set mode INPUT_PULLUP Loop digitalRead(pin) - Function returns the value read from pin

Digital Input Example 4 int a; void setup() { Serial.begin(9600); pinMode(2, INPUT_PULLUP); } void loop() a = digitalRead(2); Serial.println(a); delay(100);