Top Banner
ARDUINO 학습 1주차 7/22~ 7/28 김진황
23

1 Arduino 학습

Nov 22, 2015

Download

Documents

아두이노 학습
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • ARDUINO

    1

    7/22~ 7/28

  • ARDUINO UNO DIGITAL PORT:

    ANALOG PORT:

    Reset

    ? ?

    . !!!!

  • LED

    Tip)

    1) 2) 1) 2)

  • .

    :1.5.7 (Windows 7), :"Arduino Uno" (3%) 1,068 . 32,256 . (0%) 11 , 2,037 . 2,048 . avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x01 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x01 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x01 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x01 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x01 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x01 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x01 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x01 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x01 avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x01 " " >

    reset USB .

  • FND LED LED . ( .) , LED . 4. . 40mA. , LED . . . , 40mA , 200mA . .

  • 2 SOS

  • LED

  • 3 / LED control bright int ledPin = 3; int brightness = 0; int increment = 1; void setup() { // put your setup code here, to run once: // analogWright } void loop() { // put your main code here, to run repeatedly: if(brightness>255){ increment = -1; }else if(brightness < 1){ increment = 1; } brightness = brightness + increment; analogWrite(ledPin, brightness); delay(10); }

    Pulse with modulation !

    LED

  • #define LED 13 #define ANALOG A0 // gabyun value int nA0_Value = 0; void setup() { // put your setup code here, to run once: pinMode(LED, OUTPUT); Serial.begin(9600); } void loop() { // put your main code here, to run repeatedly: nA0_Value = analogRead(ANALOG); Serial.print(" "); Serial.println(nA0_Value); delay(10); }

    .

  • 5V : GND : A0 :

  • 4cm

    , ..

  • Tool kit sketch

    - - - .

    Sketch Program - () - setup loop

    - Setup : , ( ) - Loop :

    main() init() . setup() . loop() . for return .

  • System defined Data Type . !

    boolean true false . ( ) . true false HIGH LOW . , digitalWrite(pin, HIGH), digitalWrite(pin, true) digitalWrite(pin,1) LED .

    double .

  • (PWM)

    - PWM , IDE 0~255

    DC

    PN2222

    1N4001

    270

  • . L293D .

    LED 5V Relay Module 220V (7/25)

  • (

    500) On/Off .

    #define LED 13 #define ANALOG A0 // i think this value is string data. // gabyun value. int nA0ReadValue = 0; // analog reading value int nD13LedPin = 13; // digital output value void setup() { // put your setup code here, to run once: pinMode(LED, OUTPUT); // 13 port output mode setting. Serial.begin(9600); // Serial class method begin with 9600 // Serial.begin() using serial port 9600 for printing console }// end of setup void loop() { // put your main code here, to run repeatedly: nA0ReadValue = analogRead(ANALOG); // A0 read sensing data from IR sensor. Serial.print(" "); // remove first Serial.println(nA0ReadValue); // console print nA0Value value and \0 if(nA0ReadValue >= 500){ // Thresholding value 500 digitalWrite(nD13LedPin, HIGH); // turn on }else{ digitalWrite(nD13LedPin, LOW); // turn off } delay(100); // delay 100 msec = 0.1sec. }// end of loop

    LED ON/OFF

    ) - -

    .

  • X

    -

    on

    on

  • 2

    IR

    Relay Module 220V