Presentation is loading. Please wait.

Presentation is loading. Please wait.

UTA010 : Engineering Design – II

Similar presentations


Presentation on theme: "UTA010 : Engineering Design – II"— Presentation transcript:

1 UTA010 : Engineering Design – II
Mangonel/Catapult Design Project Lecture 1 Amanpreet Kaur Copyright 2013-­‐2014 Electronics and Communication Engineering Department

2 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 1KB EEPROM By Sebastian Goscik for EARS

3 Arduino Uno

4 Getting Started Check out: http://arduino.cc/en/Guide/HomePage
Download & install the Arduino environment (IDE)(not needed in lab) Connect the board to your computer via the USB cable If needed, install the drivers (not needed in lab) Launch the Arduino IDE Select your board Select your serial port Open the blink example Upload the program

5 Arduino IDE See: for more information

6 Select Serial Port and Board

7 EXAMPLE

8 Inside a Light Emitting Diode
                                                                                                                                                                                                                                        Transparent Plastic Case Terminal Pins Diode

9 Kinds of LEDs

10 How to Connect a LED: Requires 1.5~2.5V and 10 mA To prevent overloading, use resistor 470 Ω

11 LEDs By Sebastian Goscik for EARS

12 Connect LED to BS2 LED is on when P0 is high LED is on when P1 is low

13 External LEDs Try make an LED pin blink in a pattern on a pin of your choice

14 Structure of an Arduino “sketch”
void setup() { // put your setup code here, to run once: } void loop() { // put your main code here, to run repeatedly: Before you show the NB, switch to desktop view and do it together with them NB: A copy of this can be found in File>Examples>1. Basics>BareMinimum By Sebastian Goscik for EARS

15 Important functions Serial.println(value); pinMode(pin, mode);
Prints the value to the Serial Monitor on your computer pinMode(pin, mode); Configures a digital pin to read (input) or write (output) a digital value digitalRead(pin); Reads a digital value (HIGH or LOW) on a pin set for input digitalWrite(pin, value); Writes the digital value (HIGH or LOW) to a pin set for output

16 first sketch int onBoardLED; void setup() { //Arduinos have an on-board LED on pin 13 onBoardLED = 13; pinMode(onBoardLED, OUTPUT); } void loop() { digitalWrite(onBoardLED, HIGH); delay(500); //delay measured in milliseconds digitalWrite(onBoardLED, LOW); delay(500); Explain then show programming Dissect the code line by line: Void = return type of the function. Tell them we will go into functions more later Setup = fuction name Int onBoardLED = 3 = A whole number variable called onBoardLED and we assign the value 13. This is like a name for a number much like algebra ; < must go on the end of every line that isn’t a function definition pinMode = digitalWrite = Comment = Delay =

17 Breadboard Breadboard get their name from old circuits that where made by putting copper nails into bread cutting boards and wire was wrapped around them By Sebastian Goscik for EARS

18 Example Using LED void setup() {
pinMode(77, OUTPUT); //configure pin 77 as output } // blink an LED once void blink1() digitalWrite(77,HIGH); // turn the LED on delay(500); // wait 500 milliseconds digitalWrite(77,LOW); // turn the LED off


Download ppt "UTA010 : Engineering Design – II"

Similar presentations


Ads by Google