2013年5月13日 星期一

week 12. arduino actuator tutorial

servo moto control
potential meter input


feature project site:

http://ciid.dk/education/portfolio/idp13/courses/physical-computing/projects/

8 則留言:

  1. 焊接技巧:

    http://blog.tmu.edu.tw/cool8/%E7%84%8A%E6%8E%A5%E6%8A%80%E5%B7%A7.pdf
    http://www.hk-tree.org/downloads/DivisionIIISoldering.pdf

    piezo + servo
    Example:
    http://www.youtube.com/watch?v=OBRTMCDxbJ0

    http://www.instructables.com/answers/Would-arduino-be-good-for-a-piezo-triggering-a-ser/

    回覆刪除
  2. 練習範例:
    digital >> DigitalInputPullup
    analog >> analogInoutSerial
    servo >> sweep

    回覆刪除
  3. servo motor 接線圖:

    http://www.azega.com/wp-content/uploads/2011/02/Arduino_Servo_1.png

    回覆刪除
  4. 作者已經移除這則留言。

    回覆刪除

  5. #include "Servo.h"
    Servo myservo;
    void setup()
    {
    myservo.attach(9);
    pinMode(2, INPUT_PULLUP);
    }
    void loop()
    {
    int sensorVal = digitalRead(2);
    if(sensorVal == HIGH)
    {
    myservo.write(150);
    }
    else{
    myservo.write(10);
    }
    }

    回覆刪除
  6. 光敏接線圖:
    http://fritzing.org/media/fritzing-repo/projects/s/simple-ldr/images/ldr_mounting_.png

    使用範例:
    analogInoutSerial

    回覆刪除
  7. #include "Servo.h"
    Servo myservo;
    const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
    const int analogOutPin = 9; // Analog output pin that the LED is attached to
    int sensorValue = 0; // value read from the pot
    int outputValue = 0; // value output to the PWM (analog out)
    void setup() {
    myservo.attach(9);
    Serial.begin(9600);
    }

    void loop() {
    sensorValue = analogRead(analogInPin);
    outputValue = map(sensorValue, 0, 1023, 0, 255);
    if(sensorValue > 100){
    myservo.write(150);
    }
    else{
    myservo.write(10);
    }

    Serial.print("sensor = " );
    Serial.print(sensorValue);
    Serial.print("\t output = ");
    Serial.println(outputValue);

    delay(100);
    }

    回覆刪除
  8. #include "Servo.h"
    Servo myservo;
    const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
    const int analogOutPin = 9; // Analog output pin that the LED is attached to
    int sensorValue = 0; // value read from the pot
    int outputValue = 0; // value output to the PWM (analog out)
    void setup() {
    myservo.attach(9);
    Serial.begin(9600);
    }

    void loop() {
    sensorValue = analogRead(analogInPin);
    outputValue = map(sensorValue, 0, 1023, 0, 255);

    if(sensorValue > 0){
    myservo.write(150);
    Serial.println("big");
    delay(3000);
    }
    else{
    Serial.println("small");
    myservo.write(10);
    }

    Serial.print("sensor = " );
    Serial.print(sensorValue);
    Serial.print("\t output = ");
    Serial.println(outputValue);

    delay(100);
    }

    回覆刪除