Arduino Programming Part 1

Similar documents
Basic Pulse Width Modulation

Arduino project. Arduino board. Serial transmission

Arduino Lesson 16. Stepper Motors

Your Multimeter. The Arduino Uno 10/1/2012. Using Your Arduino, Breadboard and Multimeter. EAS 199A Fall Work in teams of two!

A REST API for Arduino & the CC3000 WiFi Chip

Arduino ADK Back. For information on using the board with the Android OS, see Google's ADK documentation.

Eric Mitchell April 2, 2012 Application Note: Control of a 180 Servo Motor with Arduino UNO Development Board

Arduino Microcontroller Guide W. Durfee, University of Minnesota ver. oct-2011 Available on-line at

Sending an SMS with Temboo

Arduino Lesson 1. Blink

Lab 6 Introduction to Serial and Wireless Communication

Basic DC Motor Circuits. Living with the Lab Gerald Recktenwald Portland State University

Basic DC Motor Circuits

ANDROID BASED FARM AUTOMATION USING GR-SAKURA

Arduino Due Back. Warning: Unlike other Arduino boards, the Arduino Due board runs at 3.3V. The maximum. Overview

Arduino Lesson 5. The Serial Monitor

1602 LCD adopts standard 14 pins(no backlight) or 16pins(with backlight) interface, Instruction of each pin interface is as follows:

Using Arduino Microcontrollers to Sense DC Motor Speed and Position

The Answer to the 14 Most Frequently Asked Modbus Questions

Arduino Lesson 14. Servo Motors

Arduino DUE + DAC MCP4922 (SPI)

Lecture 7: Programming for the Arduino

EARTH PEOPLE TECHNOLOGY SERIAL GRAPH TOOL FOR THE ARDUINO UNO USER MANUAL

#include <Gamer.h> Gamer gamer; void setup() { gamer.begin(); } void loop() {

Bluetooth + USB 16 Servo Controller [RKI-1005 & RKI-1205]

Arduino Shield Manual

Temperature Measurement with a Thermistor and an Arduino

Microcontroller Programming Beginning with Arduino. Charlie Mooney

4/Really Getting Started with Arduino

Arduino-Based Dataloggers: Hardware and Software David R. Brooks Institute for Earth Science Research and Education V 1.2, June, , 2015

GM862 Arduino Shield

PHYS 2P32 Project: MIDI for Arduino/ 8 Note Keyboard

Adafruit SHT31-D Temperature & Humidity Sensor Breakout

Workshop 7 PC Software - Tracker

Work with Arduino Hardware

Introduction to Arduino

DS1307 Real Time Clock Breakout Board Kit

Application Note IMU Visualization Software

V out. Figure 1: A voltage divider on the left, and potentiometer on the right.

The self-starting solar-powered Stirling engine

Theory and Practice of Tangible User Interfaces. Thursday Week 2: Digital Input and Output. week. Digital Input and Output. RGB LEDs fade with PWM

Temperature Measurement with a Thermistor and an Arduino

INTRODUCTION TO SERIAL ARM

Working with microcontroller-generated audio frequencies (adapted from the Machine Science tutorial)

Arduino Shield Manual

Programing the Microprocessor in C Microprocessor System Design and Interfacing ECE 362

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.

Yun Shield Quick Start Guide VERSION: 1.0 Version Description Date 1.0 Release 2014-Jul-08 Yun Shield Quick Start Guide 1 / 14

Arduino provides a standard form factor that breaks the functions of the micro-controller into a more accessible package.

Waspmote. Quickstart Guide

Programming the Arduino

Adafruit BME280 Humidity + Barometric Pressure + Temperature Sensor Breakout

IR Communication a learn.sparkfun.com tutorial

EasyC. Programming Tips

Bidirectional wireless communication using EmbedRF

SMS Alarm Messenger. Setup Software Guide. SMSPro_Setup. Revision [Version 2.2]

Building a Basic Communication Network using XBee DigiMesh. Keywords: XBee, Networking, Zigbee, Digimesh, Mesh, Python, Smart Home

Computer Architectures

H-Bridge Motor Control

Character LCDs. Created by Ladyada. Last updated on :45:29 PM EDT

Sending Data from a computer to a microcontroller using a UART (Universal Asynchronous Receiver/Transmitter)

Connecting Arduino to Processing a

Arduino Motor Shield (L298) Manual

1 of 5 12/31/ :51 AM

Example Connection between USB Host and Android

1.00 Lecture 1. Course information Course staff (TA, instructor names on syllabus/faq): 2 instructors, 4 TAs, 2 Lab TAs, graders

Cart Interface Installation & Control Board Manual for M38 XP and RX Carts and Legacy M39 Carts

Electronic Brick of Current Sensor

Tiny Arduino Music Visualizer

Arduino Lesson 13. DC Motors. Created by Simon Monk

Animated Lighting Software Overview

Introduction to Arduino

Controller Demo Software. Simple V1.6. Copyright 2010 Reef Angel. All Rights Reserved

WA Manager Alarming System Management Software Windows 98, NT, XP, 2000 User Guide

Android Application Development and Bluetooth Technology

TUTORIAL 3 :: ETHERNET SHIELD AND TWITTER.COM

TSL2561 Luminosity Sensor

InTouch Example Description

Modbus and ION Technology

Special Lecture. Basic Stamp 2 Programming. (Presented on popular demand)

TUTORIAL FOR INITIALIZING BLUETOOTH COMMUNICATION BETWEEN ANDROID AND ARDUINO

Adafruit MCP9808 Precision I2C Temperature Sensor Guide

C4DI Arduino tutorial 4 Things beginning with the letter i

Sensor Technology Interface

JNIOR. Overview. Get Connected. Get Results. JNIOR Model 310. JNIOR Model 312. JNIOR Model 314. JNIOR Model 410

Wireless Communication With Arduino

Data Acquisition Module with I2C interface «I2C-FLEXEL» User s Guide

Tire pressure monitoring

Introduction to Python

Lab Experiment 1: The LPC 2148 Education Board

Getting Started with PIC24F/PIC24H Programming and Interfacing in C

MCP4725 Digital to Analog Converter Hookup Guide

Technical Support Set-up Procedure

ENGI E1112 Departmental Project Report: Computer Science/Computer Engineering

AKD EtherNet/IP Communication

User Manual. AS-Interface Programmer

Modern Robotics, Inc Core Device Discovery Utility. Modern Robotics Inc, 2015

SMS GSM Alarm Messenger

An Introduction to MPLAB Integrated Development Environment

LCD I 2 C/Serial RX Backpack. Data Sheet. LCD to I2C/Serial RX Backpack I2C or Serial RX communication with Standard 16 Pin LCD modules

Transcription:

Arduino Programming Part 1 EAS 199A, Fall 2010, Lecture 5 Gerald Recktenwald Portland State University gerry@me.pdx.edu

Overview Discuss details, now that you had a taste Arduino Environment Basic code components Two required functions: startup() and loop() Variables Calling built-in functions 2

References These notes borrow from Arduino web site http://arduino.cc/en/guide/environment http://arduino.cc/en/tutorial/homepage Adafruit tutorial #1 and 2 http://www.ladyada.net/learn/arduino/lesson2.html Leah Buechley s Introduction to Arduino http://web.media.mit.edu/~leah/lilypad/03_arduino_intro.html 3

Basic Process Design the circuit: What are electrical requirements of the sensors or actuators? Identify inputs (analog inputs) Identify digital outputs Write the code Build incrementally Get the simplest piece to work first Add complexity and test at each stage Save and Backup frequently Use variables, not constants Comment liberally 4

Writing and Downloading Code Write sketch on PC A Download sketch to Arduino A 5

Running Code While Tethered Run sketch on Arduino and send data back to PC Arduino interacts with its environment A Serial communication back to host 6

Running Code Stand-Alone Run Arduino in stand alone mode A Arduino interacts with its environment and runs on battery power 7

Arduino IDE Stop serial monitor Verify/Compile New sketch Open sketch Save sketch Upload sketch Open Serial monitor IDE = Integrated Development Environment Tab controls http://www.arduino.cc/en/guide/environment Code pane Message pane 8

Arduino IDE Stop serial monitor Verify/Compile New sketch Open sketch Save sketch Upload sketch Open Serial monitor Tab controls http://www.arduino.cc/en/guide/environment 9

Arduino Web Site References Overview of the development environment http://www.arduino.cc/en/guide/environment Language reference http://arduino.cc/en/reference/homepage Code tutorials http://arduino.cc/en/tutorial/homepage 10

Code Structure: Header Header provides information. Later, it will also contain code 11

Code Structure: setup function setup function is executed only once at the start 12

Code Structure: loop function loop function is repeated indefinitely 13

Code pinmode(13, Output) prepare pin 13 for outputs of voltage Digital I/O Functions: pinmode digitalwrite digitalread 14

Code digitalwrite(13, HIGH) Sets pin 13 to voltage that means on Digital I/O Functions: pinmode digitalwrite digitalread 15

Code delay(1000); tells microcontroller to do nothing for 1000 ms = 1 s Digital I/O Functions: pinmode digitalwrite digitalread 16

Code digitalwrite(13, LOW) Sets pin 13 to voltage that means off Digital I/O Functions: pinmode digitalwrite digitalread 17

Arduino Variable Types int Integer values: 1, 2, 3, -4, 7234 float double Values with non-zero fractional part, 7 digits Currently the same as a float. Normally a double stores values with non-zero fractional part, 15 digits char Character values: a, b, D, 1 boolean True or false values 18

Using variables and functions Assigning values: Defines the variable name as red_led_pin int red_led_pin = 5; Defines the variable type as an integer Uses the value stored in red_led_pin pinmode( red_led_pin, OUTPUT ); calls the function named pinmode HIGH and OUTPUT are pre-defined constants digitalwrite( red_led_pin, HIGH ); calls the function named digitalwrite 19