UTA 010 Engineering Design II MangonelCatapult Design Project

  • Slides: 18
Download presentation
UTA 010 : Engineering Design – II Mangonel/Catapult Design Project Amanpreet Kaur Electronics and

UTA 010 : Engineering Design – II Mangonel/Catapult Design Project Amanpreet Kaur Electronics and Communication Engineering Department Copyright 2013‐ Lecture 1

What is an Arduino? Features • 14 Digital I/O pins • 6 Analogue inputs

What is an Arduino? Features • 14 Digital I/O pins • 6 Analogue inputs • 6 PWM pins • USB serial • 16 MHz Clock speed • 32 KB Flash memory • 2 KB SRAM • 1 KB EEPROM By Sebastian Goscik for EARS

Arduino Uno

Arduino Uno

Getting Started Check out: http: //arduino. cc/en/Guide/Home. Page 1. Download & install the Arduino

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

Arduino IDE See: http: //arduino. cc/en/Guide/Environment for more information

Arduino IDE See: http: //arduino. cc/en/Guide/Environment for more information

Select Serial Port and Board

Select Serial Port and Board

EXAMPLE

EXAMPLE

Inside a Light Emitting Diode 1. Transparent Plastic Case 2. Terminal Pins 3. Diode

Inside a Light Emitting Diode 1. Transparent Plastic Case 2. Terminal Pins 3. Diode

Kinds of LEDs

Kinds of LEDs

How to Connect a LED: Requires 1. 5~2. 5 V and 10 m. A

How to Connect a LED: Requires 1. 5~2. 5 V and 10 m. A To prevent overloading, use resistor 470 Ω

LEDs By Sebastian Goscik for EARS

LEDs By Sebastian Goscik for EARS

Connect LED to BS 2 LED is on when P 0 is high LED

Connect LED to BS 2 LED is on when P 0 is high LED is on when P 1 is low

External LEDs Try make an LED pin blink in a pattern on a pin

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

Structure of an Arduino “sketch” void setup() { // put your setup code here,

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: } NB: A copy of this can be found in File>Examples>1. Basics>Bare. Minimum By Sebastian Goscik for EARS

Important functions Serial. println(value); Prints the value to the Serial Monitor on your computer

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

first sketch int on. Board. LED; void setup() { //Arduinos have an on-board LED

first sketch int on. Board. LED; void setup() { //Arduinos have an on-board LED on pin 13 on. Board. LED = 13; pin. Mode(on. Board. LED, OUTPUT); } void loop() { digital. Write(on. Board. LED, HIGH); delay(500); //delay measured in milliseconds digital. Write(on. Board. LED, LOW); delay(500); }

Breadboard By Sebastian Goscik for EARS

Breadboard By Sebastian Goscik for EARS

Example Using LED void setup() { pin. Mode(77, OUTPUT); //configure pin 77 as output

Example Using LED void setup() { pin. Mode(77, OUTPUT); //configure pin 77 as output } // blink an LED once void blink 1() { digital. Write(77, HIGH); // turn the LED on delay(500); // wait 500 milliseconds digital. Write(77, LOW); // turn the LED off delay(500); // wait 500 milliseconds }