Introduction to Arduino A very basic intro to Arduino, the IDE and the Servos class.

Slides:



Advertisements
Similar presentations
Wireless Cue Light Project
Advertisements

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
Lecture 1 – Arduino Basics
Lab7: Introduction to Arduino
Anurag Dwivedi & Rudra Pratap Suman.  Open Source electronic prototyping platform based on flexible easy to use hardware and software.
Embedded Sumo 1T4 – 1T5 UTRA.
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.
1 Arduino Board: Arduino UNO Arduino Programing Environment: Arduino 0022
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.
Embedded Programming and Robotics Lesson 2 C Programming Refresher C Programming1.
Introduction to Arduino Prepared by R. Lamond.  “Arduino is an open-source electronics prototyping platform based on flexible, easy- to-use hardware.
Parallax 4x20 LCD (part number 27979) with Arduino Duemilanove
ARDUINO PROGRAMMING Working with the Arduino microcontroller.
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
Arduino Part 2 Topics: Serial Communication Programming Constructs: functions, loops and conditionals Digital Input.
Microcontroller Hands-on Workshop #3 Ahmad Manshad New Mexico State University Institute of Electrical and Electronics Engineers November 7, 2009.
Microprocessors Tutorial 1: Arduino Basics
ProtoSnap Introduction to Arduino Casey Haskell, Pete Lewis, David Stillman, Jim Lindblom, Pete Dokter, Lindsay Levkoff, Trevor Zylstra.
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
Franz Duran INTRODUCTION TO A RDUINO PROGRAMMING & INTERFACING Engr. Franz Duran, MEP-ECE RapidSignal Electronics.
Tweaking Your Simon Adding a photoresistor and changing code Instruction by Pete Lewis and Linz Craig.
Wall Encounter By Made easy by Dwayne Abuel.
SAMI MAKERSPACE MAKE: AN ELECTRONICS WORKSHOP. ARDUINO BASICS Credit to: Sparkfun and Linz Craig, Nick Poole, Prashanta Aryal, Theo Simpson, Tai Johnson,
Microcontrollers, Microcomputers, and Microprocessors
Arduino The Internet of Things: Using the Arduino to Teach Coding.
Arduino Training New Mexico Mathematics, Engineering, and Science Achievement (NM MESA) Getting Started.
Arduino libraries Datatekniker Udvidet hardware/software.
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?
Arduino + Bluetooth TYWu. Connection Arduino + Bluetooth Module.
Istituto Tecnico Industriale A.Monaco EURLAB Control a Servo Motor If you want to swing an robot arm or … steer a robot you need a special motor (Servo).
Intro to Arduino Basic Arduino John Wolf (WolfDenElectronics.com)
Arduino “Getting Started” Instructor : Dr Matthew Miss Khin Yi Kyaw
ME 120: Arduino Programming Arduino Programming Part 1 ME 120 Mechanical and Materials Engineering Portland State University
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.
Having fun with code, using Arduino in a middle school CS classroom
Arduino - Introduction
Application of Programming: Scratch & Arduino
Microcontroller basics
If you want to swing an robot arm or …
Val Manes Department of Math & Computer Science
Microcontroller basics
Arduino & its hardware interfacing
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
INC 161 , CPE 100 Computer Programming
Arduino.
Arduino - Introduction
Roller Coaster Design Project
Introduction to Arduinos
FeMaidens Programming
Arduino 101 Credit(s):
Working with Arduino: Lesson #1: Getting Acquainted with the Kit
Welcome to Digital Electronics using the Arduino Board
Arduino : Introduction & Programming
CTY SAR FCPS Shawn Lupoli, Elliot Tan
Aeroponic Engineering and Vertical Farming
Arduino Uno circuit basics
Introduction to Arduinos
SAURABH GINGADE.
Arduino程式範例.
Introduction to Arduino IDE and Software
Presentation transcript:

Introduction to Arduino A very basic intro to Arduino, the IDE and the Servos class

The Arduino Board

Pins 0-13 can be used for input or output 3 Ground Ports 1 5V Port 1 3.3V Port Some ports support PWM (Pulse Wave Modulation): Ports 3,5,6,10,11 Ports 0/1 are RX (Receiving), and TX (Sending) – Typically used for Bluetooth Modules/Shields

The IDE IDE stands for “Integrated Development Environment” – This helps us rapidly develop and deploy programs to our Arduino Arduino provides a Windows Install File to help us install the IDE and the necessary drivers for communicating with our Arduino

The IDE

The previous slide shows the basic layout when you open the Arduino IDE Typically, Arduino is coded in C++ -- the compiler/assembler will do the rest Two methods: setup() and loop() – you may add your own classes for inclusion as well as writing your own methods to be called Setup() is only called once and is typically used to setup ports on your Arduino among other things Loop() is where you put code that you want run until you turn off your Arduino

The IDE

As you can see, the IDE is fairly powerful and complete. However, for this tutorial, we are only going to be concerning ourselves with “File” and “Sketch”

Basics of Arduino Programming Pretty much the same as any other Programming Languages. Sample Code to turn LEDs on and off on the next page

Sample Code Int LED0 = 2; int delay_time = 100; void setup() { pinMode(LED0, OUTPUT); } void loop() { digitalWrite(LED0,HIGH); delay(delay_time); digitalWrite(LED0,LOW); }

Sample Code Breakdown We declare and initialize a variable “LED0” with our Port number (In this instance, it is 2 but if you had your cable plugged into 13, it would be 13) We declare and initialize a variable “delay_time.” This sets the time between turning the LED on/off. Setup() is called and we use pinMode to set LED0 as an Output port on the Arduino. Ports are bi- directional. They can be used as Input or Output.

Sample Code Breakdown After setup() has finished running, the Arduino then calls loop() In the loop, we have 2 items: digitalWrite and delay digitalWrite(LED0,HIGH) turns the LED on digitalWrite(LED0,LOW) turns the LED off Delay(delay_time) sets how long it is waiting before the next instruction is run on the Arduino.

Servos Let’s switch to something a little bit more advanced than LEDs. Arduino provides a class to power and control Servo motors o See: All you do is put #include before anything else and off you go. My example will be slightly different

Servo Code #include ContinuousRotationServo Servo; ContinuousRotationServo ServoTwo; int timer = 3; void setup() { Servo.begin(13); Servo.begin(12); } void loop() { Servo.rotateLeft(100); ServoTwo.rotateRight(100); delay(timer); }

Servos Code Breakdown We create objects of our ContinuousRotationServo class. In setup, it is effectively doing the same thing as what we were doing earlier in our LED example. In loop, we are having the Arduino move one Servo left and one Servo right. In this specific case, the Servos are attached to a Parallax Bo-Bot body with the Arduino and breadboard sitting on top so it is moving in a straight line.

Questions? Comments? If you have any questions or comments, please register on my website and post on a comment on the Arduino page located on the Computer Science portion of my website. PPT Last Updated on: 12/26/2013