SlideShare ist ein Scribd-Unternehmen logo
1 von 43
Downloaden Sie, um offline zu lesen
阿爾杜伊諾
     Arduino: Lv. 1




Mutienliao.TW    , 2013-03-18
Arduino
Introduction
Human Computer Interactive / Interface ??
physical computing system
What is Arduino?
Open Source
Arduino Hardware   Arduino Software   Physical Computing Platform & Group
•                    14          Digital Pins 0-13                •   Reset      - S1
•   Digital Pins 0-1/Serial In/Out - TX/RX                        •
    -              Serial port                         Pin 0,1.   •           Jumper       USB        DC   (Duemilanove   )
•              6        Analog Input Pins 0-5                     •   USB
•            Analog Output * (Digital Pins 3,5,6,9,10,11)         •            Vin, 5V, 3.3V (Diecimila     )
各式各樣的Arduino........族繁不及備載
Digital Out   Digital In   Analog In   Analog Out   Communication
Digital Out
Analog Out
Digital In
Analog In
Communication
Digital In    Digital Out   Communication




Emotion   Experience
                              Analog In      Analog Out
| Prepare to test Arduino board




-      Arduino

-       LED Blink
    File > Examples > Basic > Blink
| Set up your board
•                      : Tools > Board




                 [ Mac OS X ]                                       [ Windows ]




•    Arduino         serial port:             Tools > Serila Port




                 [ Mac OS X ]                                        [ Windows ]
           Mac          /dev/tty.usbserial-     *
| Upload the program
| Upload the program




                                                                          Vertify
  •       File > Examples > Basic > Blink

  •

  •            ....
                                                                      Update to board*




                                                                                    TX/RX LED




                                                                                                       2~3
                                                                                         Pin13   pin
                                                                                    (                   )



* Arduino NG                           Reset   Update   Arudino   Reset
                                  Reset        Update
# | Troubleshooting




•                          Serial port

•

• Serial Port                             Serila port

•               Jump                              Duemilanove/UNO

•                                 Reset                         Reset   Update

•                Arudino                         USB

•
breadborad
Digital Out




              Digital Out
#1 | Blink
HIGH                            1

           LOW                            0


• Only 1 or 0 / High or LOW / ON or OFF
#1                File > Examples > Basic > Blink



int ledPin = 13;                              // LED connected to digital pin 3


void setup()
{
  pinMode(ledPin, OUTPUT);                    // sets the digital pin as output
}

void loop()
{
  digitalWrite(ledPin, HIGH);                 // sets the LED on
  delay(1000);                                // waits for a second
  digitalWrite(ledPin, LOW);                  // sets the LED off
  delay(1000);                                // waits for a second
}




   pinMode(pin, Mode)        digitalWrite(pin, value)         delay(ms)
LED


              pin ?


(      )            pin?
    pinMode(who, ?)

      (        )
    digitalWrite(who,?)
#2 | Loop
#2                   File > Examples > Control > ForLoopIteration




int timer = 100;                       // The higher the number, the slower the timing.

void setup()
{
  int i;

    // use a for loop to initialize each pin as an output:
    for (int thisPin = 2; thisPin <= 7; thisPin++ ) {
      pinMode(thisPin, OUTPUT);
    }
}

void loop() {
  // loop from the lowest pin to the highest:
  for (int thisPin = 2; thisPin <=7 ; thisPin++) {
    // turn the pin on:
    digitalWrite(thisPin, HIGH);
    delay(timer);
    // turn the pin off:
    digitalWrite(thisPin, LOW);
  }

    // loop from the highest pin to the lowest:
    for (int thisPin = 7; thisPin >= 2; thisPin--) {
      // turn the pin on:
      digitalWrite(thisPin, HIGH);
      delay(timer);
      // turn the pin off:
      digitalWrite(thisPin, LOW);
    }
}
#Bonus | Light Talk
#Bonus                          http://mutienliao.tw/arduino/Light_Talk.pde

  int pins[] = { 2, 3, 4, 5, 6, 7 }; !!         // LED
  int lights = 6;                  ! !          // LED
  int pattens = 10;                ! !          //
  byte graphy[10][6] = { {0,1,1,1,0,0},
                         {1,1,1,1,0,0},
                         {1,1,1,1,1,0},
                         {0,1,1,1,1,0},
                         {0,0,1,1,1,1},
                         {0,0,1,1,1,1},
                         {0,1,1,1,1,0},                                                        [a]
                         {1,1,1,1,1,0},
                         {1,1,1,1,0,0},
                         {0,1,1,1,0,0} };       !
                                                //

  void setup()
  {
    for (int i = 0; i < lights; i++)    !       //                      0    light-1
      pinMode(pins[i], OUTPUT);      !!         //
  }

  void loop()
  {
    for(int k = 0; k < lights; k++) { !         //
      digitalWrite(pins[k], LOW);
    }                                                                                          [b]
    delay(40); !             !       !          //       40

      for (int i = 0; i < pattens; i++) { !     //              ...                    Fig.1
        for(int j = 0; j < lights; j++) {!      //            LED...
          if(patten[i][j]==1) {
            digitalWrite(pins[j], HIGH);    !   //                     LED
          }else {
            digitalWrite(pins[j], LOW);     !   //                     LED
          }
        }
        delay(1);                  !    !       //       1
      }

      for(int k = 0; k < lights; k++) {   !     //
        digitalWrite(pins[k], LOW);
      }
      delay(40);!              !        !       //       40
  }
byte graphy[10][6] = { {0,1,1,1,0,0},
                       {1,1,1,1,0,0},
                       {1,1,1,1,1,0},
                       {0,1,1,1,1,0},
                       {0,0,1,1,1,1},
                       {0,0,1,1,1,1},
                       {0,1,1,1,1,0},
                       {1,1,1,1,1,0},
                       {1,1,1,1,0,0},
                       {0,1,1,1,0,0} };   !
#3 | Blink Without Delay
#3                  File > Examples > Digital > BlinkWithoutDelay




const int ledPin =      13;         //    pin 13   LED

int ledState = LOW;                 //             LED
long previousMillis = 0;            //

long interval = 1000;               //                           1000ms = 1sec

void setup() {
  pinMode(ledPin, OUTPUT);
}

void loop()
{
  unsigned long currentMillis = millis();                   //

    if(currentMillis - previousMillis > interval) {         //

        previousMillis = currentMillis;                     //

        //    LED
        if (ledState == LOW)
           ledState = HIGH;
        else
           ledState = LOW;

        //    LED
        digitalWrite(ledPin, ledState);
    }
}
Delay()    :




millis()   :
輸入才是互動的精華
Digital In




         Digital Input
#6 | Button
#6 | Button
#6                File > Examples > Digital > Button




const int buttonPin = 2;       // the number of the pushbutton pin
const int ledPin = 13;         // the number of the LED pin

int buttonState = 0;           // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);
}

void loop(){
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

    // check if the pushbutton is pressed.
    // if it is, the buttonState is HIGH:
    if (buttonState == HIGH) {
      // turn LED on:
      digitalWrite(ledPin, HIGH);
    }
    else {
      // turn LED off:
      digitalWrite(ledPin, LOW);
    }
}
#7 | StateChangDetection   #7   File > Examples > Digital > StateChangDetection
#8 | Debounce   #7   File > Examples > Digital > Debounce
#|




     1

     2

     3

     4

Weitere ähnliche Inhalte

Was ist angesagt?

2015-10-21 - Arduino workshop
2015-10-21 - Arduino workshop2015-10-21 - Arduino workshop
2015-10-21 - Arduino workshoptrygvis
 
Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009Eoin Brazil
 
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009Eoin Brazil
 
Arduino electronics cookbook
Arduino electronics cookbookArduino electronics cookbook
Arduino electronics cookbookFelipe Belarmino
 
Ardublock tutorial
Ardublock tutorialArdublock tutorial
Ardublock tutorialJakie_Li
 
Arduino spooky projects_class1
Arduino spooky projects_class1Arduino spooky projects_class1
Arduino spooky projects_class1Felipe Belarmino
 
NSTA 2013 Denver - ArduBlock and Arduino
NSTA 2013 Denver - ArduBlock and ArduinoNSTA 2013 Denver - ArduBlock and Arduino
NSTA 2013 Denver - ArduBlock and ArduinoBrian Huang
 
Arduino Platform with C programming.
Arduino Platform with C programming.Arduino Platform with C programming.
Arduino Platform with C programming.Govind Jha
 
Lesson sample introduction to arduino
Lesson sample   introduction to arduinoLesson sample   introduction to arduino
Lesson sample introduction to arduinoBetsy Eng
 
Arduino Full Tutorial
Arduino Full TutorialArduino Full Tutorial
Arduino Full TutorialAkshay Sharma
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduinoavikdhupar
 
Making things sense-Day 2 (May 2011)
Making things sense-Day 2 (May 2011)Making things sense-Day 2 (May 2011)
Making things sense-Day 2 (May 2011)markumoto
 
Multi Sensory Communication 1/2
Multi Sensory Communication 1/2Multi Sensory Communication 1/2
Multi Sensory Communication 1/2Satoru Tokuhisa
 
Introduction to Arduino Programming
Introduction to Arduino ProgrammingIntroduction to Arduino Programming
Introduction to Arduino ProgrammingJames Lewis
 

Was ist angesagt? (20)

2015-10-21 - Arduino workshop
2015-10-21 - Arduino workshop2015-10-21 - Arduino workshop
2015-10-21 - Arduino workshop
 
Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009
 
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
 
Arduino
ArduinoArduino
Arduino
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Arduino electronics cookbook
Arduino electronics cookbookArduino electronics cookbook
Arduino electronics cookbook
 
Ardublock tutorial
Ardublock tutorialArdublock tutorial
Ardublock tutorial
 
Arduino spooky projects_class1
Arduino spooky projects_class1Arduino spooky projects_class1
Arduino spooky projects_class1
 
NSTA 2013 Denver - ArduBlock and Arduino
NSTA 2013 Denver - ArduBlock and ArduinoNSTA 2013 Denver - ArduBlock and Arduino
NSTA 2013 Denver - ArduBlock and Arduino
 
Arduino Platform with C programming.
Arduino Platform with C programming.Arduino Platform with C programming.
Arduino Platform with C programming.
 
Lesson sample introduction to arduino
Lesson sample   introduction to arduinoLesson sample   introduction to arduino
Lesson sample introduction to arduino
 
Arduino Full Tutorial
Arduino Full TutorialArduino Full Tutorial
Arduino Full Tutorial
 
Ardui no
Ardui no Ardui no
Ardui no
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
 
Making things sense-Day 2 (May 2011)
Making things sense-Day 2 (May 2011)Making things sense-Day 2 (May 2011)
Making things sense-Day 2 (May 2011)
 
Multi Sensory Communication 1/2
Multi Sensory Communication 1/2Multi Sensory Communication 1/2
Multi Sensory Communication 1/2
 
Introduction to Arduino Programming
Introduction to Arduino ProgrammingIntroduction to Arduino Programming
Introduction to Arduino Programming
 
Intro to Arduino.ppt
Intro to Arduino.pptIntro to Arduino.ppt
Intro to Arduino.ppt
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Aurdino presentation
Aurdino presentationAurdino presentation
Aurdino presentation
 

Andere mochten auch

Hacking into IoT using JavaScript
Hacking into IoT using JavaScriptHacking into IoT using JavaScript
Hacking into IoT using JavaScriptSajan John
 
Ertzaintza - Police: security information points of interest for visitors to ...
Ertzaintza - Police: security information points of interest for visitors to ...Ertzaintza - Police: security information points of interest for visitors to ...
Ertzaintza - Police: security information points of interest for visitors to ...Irekia - EJGV
 
OpenStack Dashboard - Diablo
OpenStack Dashboard - DiabloOpenStack Dashboard - Diablo
OpenStack Dashboard - Diablodevcamcar
 
Foss, the Cloud Engine
Foss, the Cloud EngineFoss, the Cloud Engine
Foss, the Cloud Engineraphinou
 
Introduction to Alfresco
Introduction to AlfrescoIntroduction to Alfresco
Introduction to AlfrescoWildan Maulana
 
物聯網概論 - Arduino
物聯網概論 - Arduino物聯網概論 - Arduino
物聯網概論 - ArduinoXianDe Liao
 

Andere mochten auch (6)

Hacking into IoT using JavaScript
Hacking into IoT using JavaScriptHacking into IoT using JavaScript
Hacking into IoT using JavaScript
 
Ertzaintza - Police: security information points of interest for visitors to ...
Ertzaintza - Police: security information points of interest for visitors to ...Ertzaintza - Police: security information points of interest for visitors to ...
Ertzaintza - Police: security information points of interest for visitors to ...
 
OpenStack Dashboard - Diablo
OpenStack Dashboard - DiabloOpenStack Dashboard - Diablo
OpenStack Dashboard - Diablo
 
Foss, the Cloud Engine
Foss, the Cloud EngineFoss, the Cloud Engine
Foss, the Cloud Engine
 
Introduction to Alfresco
Introduction to AlfrescoIntroduction to Alfresco
Introduction to Alfresco
 
物聯網概論 - Arduino
物聯網概論 - Arduino物聯網概論 - Arduino
物聯網概論 - Arduino
 

Ähnlich wie Arduino: Intro and Digital I/O

arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.pptZainIslam20
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerMujahid Hussain
 
Introduction to Arduino and Circuits
Introduction to Arduino and CircuitsIntroduction to Arduino and Circuits
Introduction to Arduino and CircuitsJason Griffey
 
Arduino workshop
Arduino workshopArduino workshop
Arduino workshopmayur1432
 
Scottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RADScottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RADlostcaggy
 
Powerful Electronics with Arduino
Powerful Electronics with ArduinoPowerful Electronics with Arduino
Powerful Electronics with ArduinoAbdallah Hodieb
 
Magnetic door lock using arduino
Magnetic door lock using arduinoMagnetic door lock using arduino
Magnetic door lock using arduinoSravanthi Sinha
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3Jeni Shah
 
Arduino and Robotics
Arduino and RoboticsArduino and Robotics
Arduino and RoboticsMebin P M
 
Arduino Boot Camp Pitch Slides
Arduino Boot Camp Pitch SlidesArduino Boot Camp Pitch Slides
Arduino Boot Camp Pitch SlidesMithi Sevilla
 

Ähnlich wie Arduino: Intro and Digital I/O (20)

Programming arduino makeymakey
Programming arduino makeymakeyProgramming arduino makeymakey
Programming arduino makeymakey
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino Microcontroller
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
arduino.ppt
arduino.pptarduino.ppt
arduino.ppt
 
Arduino intro.pptx
Arduino intro.pptxArduino intro.pptx
Arduino intro.pptx
 
Introduction to Arduino and Circuits
Introduction to Arduino and CircuitsIntroduction to Arduino and Circuits
Introduction to Arduino and Circuits
 
Arduino workshop
Arduino workshopArduino workshop
Arduino workshop
 
P-Space Arduino/Genuino day 2016
P-Space Arduino/Genuino day 2016P-Space Arduino/Genuino day 2016
P-Space Arduino/Genuino day 2016
 
Scottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RADScottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RAD
 
Powerful Electronics with Arduino
Powerful Electronics with ArduinoPowerful Electronics with Arduino
Powerful Electronics with Arduino
 
Magnetic door lock using arduino
Magnetic door lock using arduinoMagnetic door lock using arduino
Magnetic door lock using arduino
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3
 
Simply arduino
Simply arduinoSimply arduino
Simply arduino
 
67WS Event FIO Primer
67WS Event FIO Primer67WS Event FIO Primer
67WS Event FIO Primer
 
Arduino and Robotics
Arduino and RoboticsArduino and Robotics
Arduino and Robotics
 
Arduino Boot Camp Pitch Slides
Arduino Boot Camp Pitch SlidesArduino Boot Camp Pitch Slides
Arduino Boot Camp Pitch Slides
 

Mehr von June-Hao Hou

Processing Basics 1
Processing Basics 1Processing Basics 1
Processing Basics 1June-Hao Hou
 
Arduino: Analog I/O
Arduino: Analog I/OArduino: Analog I/O
Arduino: Analog I/OJune-Hao Hou
 
ETH+NCTU workshop 0419 Kyle
ETH+NCTU workshop 0419 KyleETH+NCTU workshop 0419 Kyle
ETH+NCTU workshop 0419 KyleJune-Hao Hou
 
ETH+NCTU workshop 0412 ETH
ETH+NCTU workshop 0412 ETHETH+NCTU workshop 0412 ETH
ETH+NCTU workshop 0412 ETHJune-Hao Hou
 
ETH+NCTU workshop 0412 Kyle group
ETH+NCTU workshop 0412 Kyle groupETH+NCTU workshop 0412 Kyle group
ETH+NCTU workshop 0412 Kyle groupJune-Hao Hou
 
ETH+NCTU workshop 0412 MS
ETH+NCTU workshop 0412 MSETH+NCTU workshop 0412 MS
ETH+NCTU workshop 0412 MSJune-Hao Hou
 
Taiwanese Tea culture
Taiwanese Tea cultureTaiwanese Tea culture
Taiwanese Tea cultureJune-Hao Hou
 
ETH_NCTU_Workshop_0405_Kyle
ETH_NCTU_Workshop_0405_KyleETH_NCTU_Workshop_0405_Kyle
ETH_NCTU_Workshop_0405_KyleJune-Hao Hou
 
ETH_NCTU_Workshop_0405_MS
ETH_NCTU_Workshop_0405_MSETH_NCTU_Workshop_0405_MS
ETH_NCTU_Workshop_0405_MSJune-Hao Hou
 
ETH_NCTU_Workshop_0329
ETH_NCTU_Workshop_0329ETH_NCTU_Workshop_0329
ETH_NCTU_Workshop_0329June-Hao Hou
 
Design Collaboration: Harvard-NCTU Experiences
Design Collaboration: Harvard-NCTU ExperiencesDesign Collaboration: Harvard-NCTU Experiences
Design Collaboration: Harvard-NCTU ExperiencesJune-Hao Hou
 

Mehr von June-Hao Hou (12)

Processing Basics 1
Processing Basics 1Processing Basics 1
Processing Basics 1
 
Arduino: Analog I/O
Arduino: Analog I/OArduino: Analog I/O
Arduino: Analog I/O
 
跨領域設計
跨領域設計跨領域設計
跨領域設計
 
ETH+NCTU workshop 0419 Kyle
ETH+NCTU workshop 0419 KyleETH+NCTU workshop 0419 Kyle
ETH+NCTU workshop 0419 Kyle
 
ETH+NCTU workshop 0412 ETH
ETH+NCTU workshop 0412 ETHETH+NCTU workshop 0412 ETH
ETH+NCTU workshop 0412 ETH
 
ETH+NCTU workshop 0412 Kyle group
ETH+NCTU workshop 0412 Kyle groupETH+NCTU workshop 0412 Kyle group
ETH+NCTU workshop 0412 Kyle group
 
ETH+NCTU workshop 0412 MS
ETH+NCTU workshop 0412 MSETH+NCTU workshop 0412 MS
ETH+NCTU workshop 0412 MS
 
Taiwanese Tea culture
Taiwanese Tea cultureTaiwanese Tea culture
Taiwanese Tea culture
 
ETH_NCTU_Workshop_0405_Kyle
ETH_NCTU_Workshop_0405_KyleETH_NCTU_Workshop_0405_Kyle
ETH_NCTU_Workshop_0405_Kyle
 
ETH_NCTU_Workshop_0405_MS
ETH_NCTU_Workshop_0405_MSETH_NCTU_Workshop_0405_MS
ETH_NCTU_Workshop_0405_MS
 
ETH_NCTU_Workshop_0329
ETH_NCTU_Workshop_0329ETH_NCTU_Workshop_0329
ETH_NCTU_Workshop_0329
 
Design Collaboration: Harvard-NCTU Experiences
Design Collaboration: Harvard-NCTU ExperiencesDesign Collaboration: Harvard-NCTU Experiences
Design Collaboration: Harvard-NCTU Experiences
 

Kürzlich hochgeladen

Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.MateoGardella
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 

Kürzlich hochgeladen (20)

Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 

Arduino: Intro and Digital I/O

  • 1. 阿爾杜伊諾 Arduino: Lv. 1 Mutienliao.TW , 2013-03-18
  • 3. Human Computer Interactive / Interface ??
  • 6. Open Source Arduino Hardware Arduino Software Physical Computing Platform & Group
  • 7. 14 Digital Pins 0-13 • Reset - S1 • Digital Pins 0-1/Serial In/Out - TX/RX • - Serial port Pin 0,1. • Jumper USB DC (Duemilanove ) • 6 Analog Input Pins 0-5 • USB • Analog Output * (Digital Pins 3,5,6,9,10,11) • Vin, 5V, 3.3V (Diecimila )
  • 9. Digital Out Digital In Analog In Analog Out Communication
  • 15. Digital In Digital Out Communication Emotion Experience Analog In Analog Out
  • 16. | Prepare to test Arduino board - Arduino - LED Blink File > Examples > Basic > Blink
  • 17. | Set up your board • : Tools > Board [ Mac OS X ] [ Windows ] • Arduino serial port: Tools > Serila Port [ Mac OS X ] [ Windows ] Mac /dev/tty.usbserial- *
  • 18. | Upload the program
  • 19. | Upload the program Vertify • File > Examples > Basic > Blink • • .... Update to board* TX/RX LED 2~3 Pin13 pin ( ) * Arduino NG Reset Update Arudino Reset Reset Update
  • 20. # | Troubleshooting • Serial port • • Serial Port Serila port • Jump Duemilanove/UNO • Reset Reset Update • Arudino USB •
  • 22. Digital Out Digital Out
  • 24. HIGH 1 LOW 0 • Only 1 or 0 / High or LOW / ON or OFF
  • 25. #1 File > Examples > Basic > Blink int ledPin = 13; // LED connected to digital pin 3 void setup() { pinMode(ledPin, OUTPUT); // sets the digital pin as output } void loop() { digitalWrite(ledPin, HIGH); // sets the LED on delay(1000); // waits for a second digitalWrite(ledPin, LOW); // sets the LED off delay(1000); // waits for a second } pinMode(pin, Mode) digitalWrite(pin, value) delay(ms)
  • 26. LED pin ? ( ) pin? pinMode(who, ?) ( ) digitalWrite(who,?)
  • 28. #2 File > Examples > Control > ForLoopIteration int timer = 100; // The higher the number, the slower the timing. void setup() { int i; // use a for loop to initialize each pin as an output: for (int thisPin = 2; thisPin <= 7; thisPin++ ) { pinMode(thisPin, OUTPUT); } } void loop() { // loop from the lowest pin to the highest: for (int thisPin = 2; thisPin <=7 ; thisPin++) { // turn the pin on: digitalWrite(thisPin, HIGH); delay(timer); // turn the pin off: digitalWrite(thisPin, LOW); } // loop from the highest pin to the lowest: for (int thisPin = 7; thisPin >= 2; thisPin--) { // turn the pin on: digitalWrite(thisPin, HIGH); delay(timer); // turn the pin off: digitalWrite(thisPin, LOW); } }
  • 30. #Bonus http://mutienliao.tw/arduino/Light_Talk.pde int pins[] = { 2, 3, 4, 5, 6, 7 }; !! // LED int lights = 6; ! ! // LED int pattens = 10; ! ! // byte graphy[10][6] = { {0,1,1,1,0,0}, {1,1,1,1,0,0}, {1,1,1,1,1,0}, {0,1,1,1,1,0}, {0,0,1,1,1,1}, {0,0,1,1,1,1}, {0,1,1,1,1,0}, [a] {1,1,1,1,1,0}, {1,1,1,1,0,0}, {0,1,1,1,0,0} }; ! // void setup() { for (int i = 0; i < lights; i++) ! // 0 light-1 pinMode(pins[i], OUTPUT); !! // } void loop() { for(int k = 0; k < lights; k++) { ! // digitalWrite(pins[k], LOW); } [b] delay(40); ! ! ! // 40 for (int i = 0; i < pattens; i++) { ! // ... Fig.1 for(int j = 0; j < lights; j++) {! // LED... if(patten[i][j]==1) { digitalWrite(pins[j], HIGH); ! // LED }else { digitalWrite(pins[j], LOW); ! // LED } } delay(1); ! ! // 1 } for(int k = 0; k < lights; k++) { ! // digitalWrite(pins[k], LOW); } delay(40);! ! ! // 40 }
  • 31. byte graphy[10][6] = { {0,1,1,1,0,0}, {1,1,1,1,0,0}, {1,1,1,1,1,0}, {0,1,1,1,1,0}, {0,0,1,1,1,1}, {0,0,1,1,1,1}, {0,1,1,1,1,0}, {1,1,1,1,1,0}, {1,1,1,1,0,0}, {0,1,1,1,0,0} }; !
  • 32. #3 | Blink Without Delay
  • 33. #3 File > Examples > Digital > BlinkWithoutDelay const int ledPin = 13; // pin 13 LED int ledState = LOW; // LED long previousMillis = 0; // long interval = 1000; // 1000ms = 1sec void setup() { pinMode(ledPin, OUTPUT); } void loop() { unsigned long currentMillis = millis(); // if(currentMillis - previousMillis > interval) { // previousMillis = currentMillis; // // LED if (ledState == LOW) ledState = HIGH; else ledState = LOW; // LED digitalWrite(ledPin, ledState); } }
  • 34. Delay() : millis() :
  • 36. Digital In Digital Input
  • 39. #6 File > Examples > Digital > Button const int buttonPin = 2; // the number of the pushbutton pin const int ledPin = 13; // the number of the LED pin int buttonState = 0; // variable for reading the pushbutton status void setup() { // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPin, INPUT); } void loop(){ // read the state of the pushbutton value: buttonState = digitalRead(buttonPin); // check if the pushbutton is pressed. // if it is, the buttonState is HIGH: if (buttonState == HIGH) { // turn LED on: digitalWrite(ledPin, HIGH); } else { // turn LED off: digitalWrite(ledPin, LOW); } }
  • 40.
  • 41. #7 | StateChangDetection #7 File > Examples > Digital > StateChangDetection
  • 42. #8 | Debounce #7 File > Examples > Digital > Debounce
  • 43. #| 1 2 3 4