Movatterモバイル変換


[0]ホーム

URL:


sdcharle, profile picture
Uploaded bysdcharle
PPTX, PDF2,013 views

Arduino slides

The document provides an overview of Arduino, including what it is, common Arduino boards, digital and analog input/output, and example projects. Arduino is an open-source electronics prototyping platform that can be used to create interactive objects. It uses a simple hardware and software environment to program and develop prototypes. The Arduino Uno is one of the most commonly used boards, which contains an Atmega328 microcontroller, digital and analog pins, and can be programmed via USB. The document describes how to connect various components like LEDs, buttons, sensors and motors to an Arduino board.

Embed presentation

Downloaded 82 times
 What is Arduino? What can I make with Arduino? Getting started Digital Inputs and Outputs Analog Inputs and Outputs Motors Putting It AllTogether Summary
“Arduino is an open-source electronicsprototyping platform based on flexible, easy-to-use hardware and software. It's intended forartists, designers, hobbyists, and anyoneinterested in creating interactive objects orenvironments.“http://www.arduino.cc/
 A programming environment forWindows,Mac or Linux A hardware specification Software libraries that can be reused in yourprogramsAll for FREE!** Except the price of the hardware you purchase
 There are many types of hardware fordifferent needs
 The most commonly used Arduino board We will be using this board in this workshop
• Microprocessor – Atmega328• 16 Mhz speed• 14 Digital I/O Pins• 6 Analog Input Pins• 32K Program Memory• 2K RAM• 1k EEPROM• Contains a special programcalled a “Bootloader”• Allows programming fromUSB port• Requires 0.5K of ProgramMemory
• USB Interface• USB client device• Allows computer toprogram theMicroprocessor• Can be used tocommunicate withcomputer• Can draw power fromcomputer to run Arduino
• Power Supply• Connect 7V – 12V• Provides required 5V toMicroprocessor• Will automatically pick USB orPower Supply to send power tothe Microprocessor
• Indicator LEDs• L – connected to digitalpin 13• TX – transmit data tocomputer• RX – receive data fromcomputer• ON – when power isapplied
• Quartz Crystal which provides16Mhz clock to Microprocessor
• Reset Button• Allows you to reset themicroprocessor soprogram will start fromthe beginning
• Input/Output connectors• Allows you to connectexternal devices tomicroprocessor• Can accept wires toindividual pins• Circuit boards “Shields”can be plugged in toconnect external devices
 Many companies have createdShields that can be used withArduino boards Examples Motor/Servo interface SD memory card interface Ethernet network interface GPS LED shields Prototyping shields
 Alarm Clock http://hackaday.com/2011/07/04/alarm-clock-forces-you-to-play-tetris-to-prove-you-are-awake/
 Textpresso http://www.geekwire.com/2012/greatest-invention-textspresso-machine-change-coffee-ordering/
 Automatic PetWater Dispenser http://hackaday.com/2011/05/24/automated-faucet-keeps-your-cat-watered/
 Get the hardware Buy an Arduino UNO Buy (or repurpose) a USB cable Get the software http://arduino.cc/en/GuideHomePage Follow the instructions on this page to installthe software Connect the Arduino to your computer You are ready to go!
 Blink the onboard LEDCongratulations!!!
/*Blink. . .*/// set the LED on// wait for a second These are comments The computer ignores them Humans can read them to learn about theprogram
void setup() {pinMode(13, OUTPUT);} Brackets { and } contain a block of code Each line of code in this block runs sequentially void setup() tells the program to only runthem once When the board turns on When the reset button is pressed
void setup() {pinMode(13, OUTPUT);} Tells the Arduino to setup pin 13 as an Outputpin Each pin you use needs be setup withpinMode A pin can be set to OUTPUT or INPUT
void loop() {digitalWrite(13, HIGH);delay(1000);digitalWrite(13, LOW);delay(1000);} void loop () runs the code block over and overuntil you turn off the Arduino This code block only runs after setup isfinished
void loop() {digitalWrite(13, HIGH);delay(1000);digitalWrite(13, LOW);delay(1000);} HIGH tells the Arduino to turn on the output LOW tells theArduino to turn off the output 13 is the pin number
void loop() {digitalWrite(13, HIGH);delay(1000);digitalWrite(13, LOW);delay(1000);} Code runs very fast Delay tells theArduino to wait a bit 1000 stands for 1,000 milliseconds or onesecond
void loop() {digitalWrite(13, HIGH);delay(500);digitalWrite(13, LOW);delay(500);} Change the 1000’s to 500 Upload the code to the Arduino What happens now?
 These pins are used to communicate with theoutside world When an output pin is HIGH, it can provide 5Vat 40mA maximum Trying to get more than 40mA out of the pin willdestroy the Microprocessor! When the output pin is LOW, it provides nocurrent You can use a transistor and/or a relay toprovide a higher voltage or more current
 Most LEDs will work with 5V at 20mA or30mA Make sure to check them before connectingto your Arduino! – Use your volt meter An LED requires a resistor to limit the current Without the resistor, the LED will draw too muchcurrent and burn itself out
 LEDs are polarized devices One side needs to be connected to + and oneside needs to be connected to – If you connect it backwards, it will not light Usually: Minus is short lead and flat side Plus is long lead and rounded side A resistor is non-polarized It can be connected either way
 Connect the two LEDs on the breadboard Modify the code to blink the second LED, too Blink them all
 The pins can be used to accept an input also Digital pins can read a voltage (1) or novoltage (0) Analog pins can read voltage between 0V and5V.You will read a value of 0 and 1023. Both of these return a value you can put intoa variable and/or make decisions based onthe value
 Exampleint x;x = digitalRead(2);if ( x == HIGH ) {digitalWrite(13, HIGH);} else {digitalWrite(13, LOW);}
 A push button can be connected to adigital pin There is an open circuit normally There is a closed circuit when pressed If connected between 5V and a pin, weget 5V when pressed, but an opencircuit when not pressed This is a problem – we need 0V whennot pressed
 There is a solution A resistor to 5V will make the pin HIGH whenthe button is not pressed Pressing it will make the pin LOW The resistor makes sure we don’t connect 5Vdirectly to Ground
 This is a common method for using pushbuttons The resistor is called a “Pull Up Resistor” TheArduino has built in pull up resistors onthe digital pins We need to enable them when we need them
 This code enables the pull up resistor:pinMode(2, INPUT);digitalWrite(2, HIGH);Or, the one line version:pinMode(2, INPUT_PULLUP);
 Connect a push button Load the basic button code Turn LEDs on/off based on button press Load the toggle code. Pay attention toreactions to your button presses, and count inthe Serial terminal. Try again with the debounce code. Did thathelp?
 There are many other devices you canconnect to an Arduino Servos to move things GPS to determine location/time RealTime Clock to know what time it is Accelerometers, Chemical detectors… LCD displays Memory cards More!
 So far we’ve dealt with the on/off digitalworld. Many interesting things we want to measure(temperature, light, pressure, etc) have arange of values.
 Very simple analog input – used to controlvolume, speed, and so on. It allows us to vary two resistance values.
 You can communicate between the Arduinoand the computer via the USB cable. This can help you out big time when you aredebugging. It can also help you control programs on thecomputer or post information to a web site.Serial.begin(9600);Serial.println(“Hello World.”);
 Connect potentiometer Upload and run code Turn the knob Watch the value change in the Serial Monitor
 There are many, many sensors based onvarying resistance: force sensors, lightdependent resistors, flex sensors, and more To use these you need to create a ‘voltagedivider’.
 R2 will be our photocell R1 will be a resistor of our choice Rule of thumb is: R1 should be in the middleof the range.
 Wire up the photocell Same code as Lab 3 Take note of the max and min values Try to pick a value for a dark/light threshold.
 Flashing a light is neat, but what about fadingone in and out? Or changing the color of an RGB LED? Or changing the speed of a motor?
 Wire up the Breadboard Load the code.Take note of the for loop. Watch the light fade in and out Experiment with the code to get differenteffects
 So far we’ve communicated with the world byblinking or writing to Serial Let’s make things move!
 Used in radio controlled planes and cars Good for moving through angles you specify#include <Servo.h>Servo myservo;void setup() {myservo.attach(9);}void loop() {}
 Wire up the breadboard Upload the code Check it out, you can control the servo! The map function makes life easy and is very,very handy:map(value, fromLow, fromHigh, toLow,toHigh);
 Upload the code for random movement. Watch the values in the Serial monitor. Runthe program multiple times. Is it reallyrandom? Try it with ‘randomSeed’, see what happens.
 For moving and spinning things Are cheap and can often be taken from oldand neglected toys (or toys from Goodwill) Here we learn three things: Transistors Using PWM to control speed Why you don’t directly attach a motor
 Wire it up Speed it up, slow it down (rawhide!)
 With a piezo or small speaker, your Arduinocan make some noise, or music (or ‘music’). As with game controllers, vibrating motorscan stimulate the sense of touch. Arduino projects exist that involve smell(breathalyzer, scent generators). For taste…KegBot? ZipWhip’s cappuccinorobot?
 Combine previous projects (photocell and thepiezo playing music) to create an instrumentthat generates a pitch based on how muchlight is hitting the photocell Feel free to get really creative with this.
 We have learned The Arduino platform components how to connect an Arduino board to the computer How to connect LEDs, buttons, a light sensor, apiezo buzzer, and motors How to send information back to the computer
 http://www.arduino.cc Getting StartedWith Arduino (Make:Projects) book BeginningArduino book Arduino: A Quick Start Guide book The adafruit learning system:https://learn.adafruit.com/
 Adafruit http://www.adafruit.com/ Spark Fun http://www.sparkfun.com/ Maker Shed http://www.makershed.com/ Digikey http://www.digikey.com/ Mouser http://www.mouser.com/ Radio Shack http://www.radioshack.com/ Find parts: http://www.octopart.com/ Sometimes Amazon has parts too Ebay can have deals but usually the parts areshipped from overseas and take a long time
 http://arduino.cc/forum/ Your local Hackerspace!
 Electronic devices depend on the movement ofelectrons The amount of electrons moving from onemolecule to another is called Current which ismeasured in Amps Batteries provide a lot of electrons that areready to move The difference in potential (the number of freeelectrons) between two points is calledElectromotive Force which is measured in Volts
 Materials that allow easy movement ofelectrons are called Conductors Copper, silver, gold, aluminum are examples Materials that do not allow easy movementof electrons are called Insulators Glass, paper, rubber are examples Some materials are poor conductors andpoor insulators. Carbon is an example
 Materials that aren’t good conductors orgood inductors provide Resistance to themovement of electrons Resistance is measured in Ohms
 Electrons flow from the negativeterminal of the battery through thecircuit to the positive terminal. But – when they discovered this,they thought current came fromthe positive terminal to thenegative This is called conventional currentflowIOops!
 There needs to be a complete circuit forcurrent to flowNo Flow! Current will Flow!
 Volts, Amps and Ohms are related This is called Ohms LawI = Current in AmpsE = EMF inVoltsR = Resistance in OhmsI=ER
 Example BAT = 9 volts R1 = 100 ohms How many amps? I = 0.09 Amps or 90mAI= 9V100W
 When dealing with really big numbers orreally small numbers, there are prefixes youcan use k = kilo = 1,000 (e.g. 10 kHz = 10,000 Hz) M = mega = 1,000,000 (e.g 1 MHz = 1,000 kHz) m = milli = 1/1,000 (e.g 33mA = 0.033A) u = micro = 1/1,000,000 (e.g 2uV = 0.000002V) n = nano = 1/1,000,000,000 p = pico = 1/1,000,000,000,000

Recommended

PDF
Introduction of Arduino Uno
PPS
Arduino Uno Pin Description
PPT
Arduino presentation by_warishusain
PDF
Arduino Lecture 1 - Introducing the Arduino
PDF
Introducing the Arduino
PPTX
Arduino and c programming
PPTX
Introduction to Arduino
PPTX
Arduino Introduction (Blinking LED) Presentation (workshop #5)
PPTX
Basics of arduino uno
PPT
Intro to Arduino
PPS
What is Arduino ?
PPTX
PPT ON Arduino
PPTX
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauri
PPTX
Ardui no
PPTX
Introduction to arduino ppt main
PPTX
Smart Blind stick by using arduino uno and sensor
PPT
Arduino
PPTX
Introduction to the Arduino
PPTX
embedded system and AVR
PPTX
Introduction to arduino
PDF
L298 Motor Driver
PPTX
Arduino
PPTX
Different Arduino Boards
PDF
Communication protocols - Embedded Systems
PDF
Introduction to Embedded System
PPTX
Introduction to Microcontroller
PPTX
ARM Processor
PPTX
ATMEGA 328
PPTX
Arduino
PPTX
Arduino Workshop (3).pptx

More Related Content

PDF
Introduction of Arduino Uno
PPS
Arduino Uno Pin Description
PPT
Arduino presentation by_warishusain
PDF
Arduino Lecture 1 - Introducing the Arduino
PDF
Introducing the Arduino
PPTX
Arduino and c programming
PPTX
Introduction to Arduino
PPTX
Arduino Introduction (Blinking LED) Presentation (workshop #5)
Introduction of Arduino Uno
Arduino Uno Pin Description
Arduino presentation by_warishusain
Arduino Lecture 1 - Introducing the Arduino
Introducing the Arduino
Arduino and c programming
Introduction to Arduino
Arduino Introduction (Blinking LED) Presentation (workshop #5)

What's hot

PPTX
Basics of arduino uno
PPT
Intro to Arduino
PPS
What is Arduino ?
PPTX
PPT ON Arduino
PPTX
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauri
PPTX
Ardui no
PPTX
Introduction to arduino ppt main
PPTX
Smart Blind stick by using arduino uno and sensor
PPT
Arduino
PPTX
Introduction to the Arduino
PPTX
embedded system and AVR
PPTX
Introduction to arduino
PDF
L298 Motor Driver
PPTX
Arduino
PPTX
Different Arduino Boards
PDF
Communication protocols - Embedded Systems
PDF
Introduction to Embedded System
PPTX
Introduction to Microcontroller
PPTX
ARM Processor
PPTX
ATMEGA 328
Basics of arduino uno
Intro to Arduino
What is Arduino ?
PPT ON Arduino
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauri
Ardui no
Introduction to arduino ppt main
Smart Blind stick by using arduino uno and sensor
Arduino
Introduction to the Arduino
embedded system and AVR
Introduction to arduino
L298 Motor Driver
Arduino
Different Arduino Boards
Communication protocols - Embedded Systems
Introduction to Embedded System
Introduction to Microcontroller
ARM Processor
ATMEGA 328

Similar to Arduino slides

PPTX
Arduino
PPTX
Arduino Workshop (3).pptx
PPTX
Arduino Slides With Neopixels
PDF
Arduino-workshop.computer engineering.pdf
PPTX
Introduction To Arduino-converted for s.pptx
 
PDF
Arduino Comic-Jody Culkin-2011
PDF
02 Sensors and Actuators Understand .pdf
PPT
01 Intro to the Arduino and it's basics.ppt
PDF
Starting with Arduino
DOCX
Basic arduino sketch example
PDF
Arduino workshop sensors
PDF
Arduino comic v0004
PPT
13223971.ppt
PPT
Physical prototyping lab2-analog_digital
PPT
Physical prototyping lab2-analog_digital
PDF
publish manual
PDF
Hardware Hacking and Arduinos
PDF
Making things sense - Day 1 (May 2011)
Arduino
Arduino Workshop (3).pptx
Arduino Slides With Neopixels
Arduino-workshop.computer engineering.pdf
Introduction To Arduino-converted for s.pptx
 
Arduino Comic-Jody Culkin-2011
02 Sensors and Actuators Understand .pdf
01 Intro to the Arduino and it's basics.ppt
Starting with Arduino
Basic arduino sketch example
Arduino workshop sensors
Arduino comic v0004
13223971.ppt
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digital
publish manual
Hardware Hacking and Arduinos
Making things sense - Day 1 (May 2011)

Recently uploaded

DOCX
Introduction to the World of Computers (Hardware & Software)
PDF
Day 3 - Data and Application Security - 2nd Sight Lab Cloud Security Class
PDF
Making Sense of Raster: From Bit Depth to Better Workflows
PDF
Digit Expo 2025 - EICC Edinburgh 27th November
PPTX
Chapter 3 Introduction to number system.pptx
PDF
DevFest El Jadida 2025 - Product Thinking
PPT
software-security-intro in information security.ppt
PPTX
Kanban India 2025 | Daksh Gupta | Modeling the Models, Generative AI & Kanban
PDF
Is It Possible to Have Wi-Fi Without an Internet Provider
PDF
Day 1 - Cloud Security Strategy and Planning ~ 2nd Sight Lab ~ Cloud Security...
PPTX
Conversational Agents – Building Intelligent Assistants [Virtual Hands-on Wor...
PDF
API-First Architecture in Financial Systems
PDF
Unser Jahresrückblick – MarvelClient in 2025
PDF
The major tech developments for 2026 by Pluralsight, a research and training ...
PPTX
Cybersecurity Best Practices - Step by Step guidelines
PPTX
cybercrime in Information security .pptx
PPTX
AI's Impact on Cybersecurity - Challenges and Opportunities
PPTX
Protecting Data in an AI Driven World - Cybersecurity in 2026
PDF
Our Digital Tribe_ Cultivating Connection and Growth in Our Slack Community 🌿...
PDF
Six Shifts For 2026 (And The Next Six Years)
Introduction to the World of Computers (Hardware & Software)
Day 3 - Data and Application Security - 2nd Sight Lab Cloud Security Class
Making Sense of Raster: From Bit Depth to Better Workflows
Digit Expo 2025 - EICC Edinburgh 27th November
Chapter 3 Introduction to number system.pptx
DevFest El Jadida 2025 - Product Thinking
software-security-intro in information security.ppt
Kanban India 2025 | Daksh Gupta | Modeling the Models, Generative AI & Kanban
Is It Possible to Have Wi-Fi Without an Internet Provider
Day 1 - Cloud Security Strategy and Planning ~ 2nd Sight Lab ~ Cloud Security...
Conversational Agents – Building Intelligent Assistants [Virtual Hands-on Wor...
API-First Architecture in Financial Systems
Unser Jahresrückblick – MarvelClient in 2025
The major tech developments for 2026 by Pluralsight, a research and training ...
Cybersecurity Best Practices - Step by Step guidelines
cybercrime in Information security .pptx
AI's Impact on Cybersecurity - Challenges and Opportunities
Protecting Data in an AI Driven World - Cybersecurity in 2026
Our Digital Tribe_ Cultivating Connection and Growth in Our Slack Community 🌿...
Six Shifts For 2026 (And The Next Six Years)

Arduino slides

  • 2.
     What isArduino? What can I make with Arduino? Getting started Digital Inputs and Outputs Analog Inputs and Outputs Motors Putting It AllTogether Summary
  • 3.
    “Arduino is anopen-source electronicsprototyping platform based on flexible, easy-to-use hardware and software. It's intended forartists, designers, hobbyists, and anyoneinterested in creating interactive objects orenvironments.“http://www.arduino.cc/
  • 4.
     A programmingenvironment forWindows,Mac or Linux A hardware specification Software libraries that can be reused in yourprogramsAll for FREE!** Except the price of the hardware you purchase
  • 5.
     There aremany types of hardware fordifferent needs
  • 6.
     The mostcommonly used Arduino board We will be using this board in this workshop
  • 7.
    • Microprocessor –Atmega328• 16 Mhz speed• 14 Digital I/O Pins• 6 Analog Input Pins• 32K Program Memory• 2K RAM• 1k EEPROM• Contains a special programcalled a “Bootloader”• Allows programming fromUSB port• Requires 0.5K of ProgramMemory
  • 8.
    • USB Interface•USB client device• Allows computer toprogram theMicroprocessor• Can be used tocommunicate withcomputer• Can draw power fromcomputer to run Arduino
  • 9.
    • Power Supply•Connect 7V – 12V• Provides required 5V toMicroprocessor• Will automatically pick USB orPower Supply to send power tothe Microprocessor
  • 10.
    • Indicator LEDs•L – connected to digitalpin 13• TX – transmit data tocomputer• RX – receive data fromcomputer• ON – when power isapplied
  • 11.
    • Quartz Crystalwhich provides16Mhz clock to Microprocessor
  • 12.
    • Reset Button•Allows you to reset themicroprocessor soprogram will start fromthe beginning
  • 13.
    • Input/Output connectors•Allows you to connectexternal devices tomicroprocessor• Can accept wires toindividual pins• Circuit boards “Shields”can be plugged in toconnect external devices
  • 14.
     Many companieshave createdShields that can be used withArduino boards Examples Motor/Servo interface SD memory card interface Ethernet network interface GPS LED shields Prototyping shields
  • 15.
     Alarm Clockhttp://hackaday.com/2011/07/04/alarm-clock-forces-you-to-play-tetris-to-prove-you-are-awake/
  • 16.
  • 17.
     Automatic PetWaterDispenser http://hackaday.com/2011/05/24/automated-faucet-keeps-your-cat-watered/
  • 19.
     Get thehardware Buy an Arduino UNO Buy (or repurpose) a USB cable Get the software http://arduino.cc/en/GuideHomePage Follow the instructions on this page to installthe software Connect the Arduino to your computer You are ready to go!
  • 20.
     Blink theonboard LEDCongratulations!!!
  • 21.
    /*Blink. . .*///set the LED on// wait for a second These are comments The computer ignores them Humans can read them to learn about theprogram
  • 22.
    void setup() {pinMode(13,OUTPUT);} Brackets { and } contain a block of code Each line of code in this block runs sequentially void setup() tells the program to only runthem once When the board turns on When the reset button is pressed
  • 23.
    void setup() {pinMode(13,OUTPUT);} Tells the Arduino to setup pin 13 as an Outputpin Each pin you use needs be setup withpinMode A pin can be set to OUTPUT or INPUT
  • 24.
    void loop() {digitalWrite(13,HIGH);delay(1000);digitalWrite(13, LOW);delay(1000);} void loop () runs the code block over and overuntil you turn off the Arduino This code block only runs after setup isfinished
  • 25.
    void loop() {digitalWrite(13,HIGH);delay(1000);digitalWrite(13, LOW);delay(1000);} HIGH tells the Arduino to turn on the output LOW tells theArduino to turn off the output 13 is the pin number
  • 26.
    void loop() {digitalWrite(13,HIGH);delay(1000);digitalWrite(13, LOW);delay(1000);} Code runs very fast Delay tells theArduino to wait a bit 1000 stands for 1,000 milliseconds or onesecond
  • 27.
    void loop() {digitalWrite(13,HIGH);delay(500);digitalWrite(13, LOW);delay(500);} Change the 1000’s to 500 Upload the code to the Arduino What happens now?
  • 28.
     These pinsare used to communicate with theoutside world When an output pin is HIGH, it can provide 5Vat 40mA maximum Trying to get more than 40mA out of the pin willdestroy the Microprocessor! When the output pin is LOW, it provides nocurrent You can use a transistor and/or a relay toprovide a higher voltage or more current
  • 29.
     Most LEDswill work with 5V at 20mA or30mA Make sure to check them before connectingto your Arduino! – Use your volt meter An LED requires a resistor to limit the current Without the resistor, the LED will draw too muchcurrent and burn itself out
  • 30.
     LEDs arepolarized devices One side needs to be connected to + and oneside needs to be connected to – If you connect it backwards, it will not light Usually: Minus is short lead and flat side Plus is long lead and rounded side A resistor is non-polarized It can be connected either way
  • 31.
     Connect thetwo LEDs on the breadboard Modify the code to blink the second LED, too Blink them all
  • 32.
     The pinscan be used to accept an input also Digital pins can read a voltage (1) or novoltage (0) Analog pins can read voltage between 0V and5V.You will read a value of 0 and 1023. Both of these return a value you can put intoa variable and/or make decisions based onthe value
  • 33.
     Exampleint x;x= digitalRead(2);if ( x == HIGH ) {digitalWrite(13, HIGH);} else {digitalWrite(13, LOW);}
  • 34.
     A pushbutton can be connected to adigital pin There is an open circuit normally There is a closed circuit when pressed If connected between 5V and a pin, weget 5V when pressed, but an opencircuit when not pressed This is a problem – we need 0V whennot pressed
  • 35.
     There isa solution A resistor to 5V will make the pin HIGH whenthe button is not pressed Pressing it will make the pin LOW The resistor makes sure we don’t connect 5Vdirectly to Ground
  • 36.
     This isa common method for using pushbuttons The resistor is called a “Pull Up Resistor” TheArduino has built in pull up resistors onthe digital pins We need to enable them when we need them
  • 37.
     This codeenables the pull up resistor:pinMode(2, INPUT);digitalWrite(2, HIGH);Or, the one line version:pinMode(2, INPUT_PULLUP);
  • 38.
     Connect apush button Load the basic button code Turn LEDs on/off based on button press Load the toggle code. Pay attention toreactions to your button presses, and count inthe Serial terminal. Try again with the debounce code. Did thathelp?
  • 39.
     There aremany other devices you canconnect to an Arduino Servos to move things GPS to determine location/time RealTime Clock to know what time it is Accelerometers, Chemical detectors… LCD displays Memory cards More!
  • 40.
     So farwe’ve dealt with the on/off digitalworld. Many interesting things we want to measure(temperature, light, pressure, etc) have arange of values.
  • 41.
     Very simpleanalog input – used to controlvolume, speed, and so on. It allows us to vary two resistance values.
  • 42.
     You cancommunicate between the Arduinoand the computer via the USB cable. This can help you out big time when you aredebugging. It can also help you control programs on thecomputer or post information to a web site.Serial.begin(9600);Serial.println(“Hello World.”);
  • 43.
     Connect potentiometerUpload and run code Turn the knob Watch the value change in the Serial Monitor
  • 44.
     There aremany, many sensors based onvarying resistance: force sensors, lightdependent resistors, flex sensors, and more To use these you need to create a ‘voltagedivider’.
  • 46.
     R2 willbe our photocell R1 will be a resistor of our choice Rule of thumb is: R1 should be in the middleof the range.
  • 47.
     Wire upthe photocell Same code as Lab 3 Take note of the max and min values Try to pick a value for a dark/light threshold.
  • 48.
     Flashing alight is neat, but what about fadingone in and out? Or changing the color of an RGB LED? Or changing the speed of a motor?
  • 50.
     Wire upthe Breadboard Load the code.Take note of the for loop. Watch the light fade in and out Experiment with the code to get differenteffects
  • 51.
     So farwe’ve communicated with the world byblinking or writing to Serial Let’s make things move!
  • 52.
     Used inradio controlled planes and cars Good for moving through angles you specify#include <Servo.h>Servo myservo;void setup() {myservo.attach(9);}void loop() {}
  • 53.
     Wire upthe breadboard Upload the code Check it out, you can control the servo! The map function makes life easy and is very,very handy:map(value, fromLow, fromHigh, toLow,toHigh);
  • 54.
     Upload thecode for random movement. Watch the values in the Serial monitor. Runthe program multiple times. Is it reallyrandom? Try it with ‘randomSeed’, see what happens.
  • 55.
     For movingand spinning things Are cheap and can often be taken from oldand neglected toys (or toys from Goodwill) Here we learn three things: Transistors Using PWM to control speed Why you don’t directly attach a motor
  • 56.
     Wire itup Speed it up, slow it down (rawhide!)
  • 57.
     With apiezo or small speaker, your Arduinocan make some noise, or music (or ‘music’). As with game controllers, vibrating motorscan stimulate the sense of touch. Arduino projects exist that involve smell(breathalyzer, scent generators). For taste…KegBot? ZipWhip’s cappuccinorobot?
  • 58.
     Combine previousprojects (photocell and thepiezo playing music) to create an instrumentthat generates a pitch based on how muchlight is hitting the photocell Feel free to get really creative with this.
  • 59.
     We havelearned The Arduino platform components how to connect an Arduino board to the computer How to connect LEDs, buttons, a light sensor, apiezo buzzer, and motors How to send information back to the computer
  • 60.
     http://www.arduino.cc GettingStartedWith Arduino (Make:Projects) book BeginningArduino book Arduino: A Quick Start Guide book The adafruit learning system:https://learn.adafruit.com/
  • 61.
     Adafruit http://www.adafruit.com/Spark Fun http://www.sparkfun.com/ Maker Shed http://www.makershed.com/ Digikey http://www.digikey.com/ Mouser http://www.mouser.com/ Radio Shack http://www.radioshack.com/ Find parts: http://www.octopart.com/ Sometimes Amazon has parts too Ebay can have deals but usually the parts areshipped from overseas and take a long time
  • 62.
  • 63.
     Electronic devicesdepend on the movement ofelectrons The amount of electrons moving from onemolecule to another is called Current which ismeasured in Amps Batteries provide a lot of electrons that areready to move The difference in potential (the number of freeelectrons) between two points is calledElectromotive Force which is measured in Volts
  • 64.
     Materials thatallow easy movement ofelectrons are called Conductors Copper, silver, gold, aluminum are examples Materials that do not allow easy movementof electrons are called Insulators Glass, paper, rubber are examples Some materials are poor conductors andpoor insulators. Carbon is an example
  • 65.
     Materials thataren’t good conductors orgood inductors provide Resistance to themovement of electrons Resistance is measured in Ohms
  • 66.
     Electrons flowfrom the negativeterminal of the battery through thecircuit to the positive terminal. But – when they discovered this,they thought current came fromthe positive terminal to thenegative This is called conventional currentflowIOops!
  • 67.
     There needsto be a complete circuit forcurrent to flowNo Flow! Current will Flow!
  • 68.
     Volts, Ampsand Ohms are related This is called Ohms LawI = Current in AmpsE = EMF inVoltsR = Resistance in OhmsI=ER
  • 69.
     Example BAT= 9 volts R1 = 100 ohms How many amps? I = 0.09 Amps or 90mAI= 9V100W
  • 70.
     When dealingwith really big numbers orreally small numbers, there are prefixes youcan use k = kilo = 1,000 (e.g. 10 kHz = 10,000 Hz) M = mega = 1,000,000 (e.g 1 MHz = 1,000 kHz) m = milli = 1/1,000 (e.g 33mA = 0.033A) u = micro = 1/1,000,000 (e.g 2uV = 0.000002V) n = nano = 1/1,000,000,000 p = pico = 1/1,000,000,000,000

[8]ページ先頭

©2009-2025 Movatter.jp