Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Chapter 1

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 27

Engineering Design -

II(Buggy)
Course Introduction
CGVR

Subject: Engineering Design - II (Buggy)


Course Code: UTA014
Credit: 6.0

Evaluation Criteria:
 Quizzes
 Lab Evaluation
 Demonstration of Three different Challenges (Bronze, Silver and
Gold)
 End Term Exam
Resources
CGVR

 http://www.tutorialspoint.com/arduino/
 https://www.arduino.cc/en/Tutorial/HomePage
 https://www.tutorialspoint.com/csharp/
 http://www.completecsharptutorial.com/
What is a Microcontroller
CGVR

www.mikroe.com/chapters/view/1

• A small computer on a single chip


• containing a processor, memory, and input/output
• Typically "embedded" inside some device that they control
• A microcontroller is often small and low cost
What is a Development Board
CGVR

• A printed circuit board


designed to facilitate
work with a particular
microcontroller.

• Typical components include:


• power circuit
• programming interface
• basic input; usually buttons and LEDs
• I/O pins
The Arduino Development Board
CGVR

Making-robots-with-arduino.pdf
The Arduino Microcontroller:
Atmel ARV Atmega 328 CGVR

Specification
Making-robots-with-arduino.pdf
What is the Arduino
CGVR

todbot.com/blog/bionicarduino
What is an Arduino ?
CGVR

 Open Source electronic prototyping platform


based on flexible easy to use hardware and
software.
Getting Started
CGVR

• Check out: http://arduino.cc/en/Guide/HomePage


1. Download & install the Arduino environment (IDE)
2. Connect the board to your computer via the UBS
cable
3. If needed, install the drivers
4. Launch the Arduino IDE
5. Select your board
6. Select your serial port
7. Open the program code
8. Upload the program
Try It: Connect the USB Cable
CGVR

todbot.com/blog/bionicarduino
Arduino IDE
CGVR

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


Select Serial Port and Board
CGVR
Status Messages
CGVR

todbot.com/blog/bionicarduino
CGVR

todbot.com/blog/bionicarduino
Add an External LED to pin 13
CGVR

• File > Examples > Digital > Blink


• LED’s have polarity
– Negative indicated by flat side of the housing
and a short leg

www.instructables.com
A Little Bit About Programming
CGVR

• Code is case
sensitive
• Statements are
commands and
must end with a
semi-colon
• Comments follow
a // or begin with /*
and end with */
• loop and setup
Our First Program
CGVR
Terminology
CGVR
Digital I/0 CGVR

www.mikroe.com/chapters/view/1

pinMode(pin, mode)
Sets pin to either INPUT or OUTPUT
digitalRead(pin)
Reads HIGH or LOW from a pin
digitalWrite(pin, value)
Writes HIGH or LOW to a pin
Arduino Timing
CGVR

• delay(ms)
– Pauses for a few milliseconds
• delayMicroseconds(us)
– Pauses for a few microseconds
Digital? Analog?
CGVR

• Digital has two values: on and off


• Analog has many (infinite) values
• Computers don’t really do analog, they quantize
• Remember the 6 analog input pins---here’s how
they work

todbot.com/blog/bionicarduino
Variables
CGVR
Putting It Together
CGVR
• Complete the sketch
(program) below.
• What output will be
generated by this program?
• What if the schematic were
changed? 

www.ladyada.net/learn/arduino
Analog to Digital Coversion
CGVR

 What is analog ?
 It is continuous range of voltage values (not just
0 or 5V)

 Why convert to digital ?


 Because our microcontroller only understands
digital.
ADC in Arduino
CGVR

 The Arduino Uno board contains 6 pins for ADC

 10-bit analog to digital converter

 This means that it will map input voltages


between 0 and 5 volts into integer values
between 0 and 1023
Reading/Writing Analog
Values CGVR

 analogRead(A0); // used to read the analog


value from the pin A0

 analogWrite(2,128);

You might also like