Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to the Arduino

Similar presentations


Presentation on theme: "Introduction to the Arduino"— Presentation transcript:

1 Introduction to the Arduino
Web site: Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software

2 What we’ll do with it: Communicate with it Program it Interface to it Build on it Learn to love it!

3 Communicate Single USB cable Provides power (5V) and coms

4 Install their software: arduino.cc/en/main/software
Communicate Install their software: arduino.cc/en/main/software This is an “IDE”: Integrated Development Environment Text editor Compiler Loader helper

5 Interface to it The software works on PC’s and Macs You won’t do anything without this software

6 Program Arduino calls their programs “Sketches” These are lists of commands that the Arduino will execute There are lots of sample sketches available online for download and modification Once in the IDE, the sketch is uploaded to Arduino

7 Program The program consists of two parts (I have no idea why they use “void”): 1) the setup Establish what hardware will be used Initialize variables 2) the executables (loop) Controls Outputs Inputs storage

8

9

10

11 There are several ways to make conditional branches/loops:
If else (like the BASIC IF/THEN) but uses {} for the “then” For (similar to BASIC FOR) but different syntax

12 We can interface using both digital or Analog inputs/outputs
PinMode sets a pin to input or output digitalWrite sets the output high or low (1 or 0) Int digitalRead returns a 0 or 1 depending on whether the input is high or low It’s important to define the role before using the “digital” commands and don’t cross them.

13 For anything that provides a varying voltage as it’s signal, you’ll need an analog input
for normal analog; how many bits is the A/D converter? It can also do a pseudo analog output (0-5V) using “pulse width modulation”; pretty clever

14

15

16

17

18 Please try to avoid clipping the leads on anything!
If they are the same on the LEDs, you can’t tell the + from the – Bending is okay

19 Project #1: a blinking LED

20 We’ll let you cheat and use the breadboard sheet! But only for this one. You have to figure out the rest yourself.

21 Here is the code; let’s look it over:
Comment section is a great idea Define the pin Turn it on; turn it off; repeat, repeat, repeat

22 Modify the program: Change blinking rate Blink two that alternate
Change intensity (this uses the pulse width modulation)

23 Project #2: Run a motor Requires a transistor to provide more power
Use the schematic; why is the diode there?


Download ppt "Introduction to the Arduino"

Similar presentations


Ads by Google