반응형
※ Servo Motor
Circuit
Source Code
Include Servo Library
#include <Servo.h>
Servo myservo;
int pos = 0;
void setup() {
// put your setup code here, to run once:
myservo.attach(9);
}
void loop() {
// put your main code here, to run repeatedly:
for(pos = 0; pos < 180; pos += 1)
{
myservo.write(pos);
delay(15);
}
}
※ Servo Motor with variable resistor
Circuit
Source Code
#include <Servo.h>
Servo myservo;
void setup() {
// put your setup code here, to run once:
myservo.attach(9);
}
void loop() {
// put your main code here, to run repeatedly:
myservo.write(map(analogRead(A0),0,1023,0,120));
delay(15);
}
refer to youtube tutorial (in Korean) : https://www.youtube.com/watch?v=s_B8KYE7xvI&index=10&list=PL0Vl139pNHbe-JlsydLg3NFRk6nC_cC7w
반응형
'IoT > Arduino' 카테고리의 다른 글
[Arduino] Motion Sensor and Water Level Sensor (0) | 2017.01.17 |
---|---|
[Arduino] Joystick, LED Dot Matrix and ADXL335 Module (0) | 2017.01.17 |
[Arduino] Ultrasonic, Keypad and Temperature and Humidity Sensor (0) | 2017.01.15 |
[Arduino] 7 Segment, Servo, LCD and Thermometer (0) | 2017.01.14 |
[Arduino] Using 74HC595 8-bit serial-in/serial or parallel-out shift register (0) | 2017.01.12 |
[Arduino] Library and RGB LED (0) | 2017.01.11 |
[Arduino] LCD and 7 Segment (0) | 2017.01.10 |
[Arduino] Illuminance (Photocell) and Ultrasonic Sensor (0) | 2017.01.09 |
[Arduino] Tri LED and Buzzer (0) | 2017.01.09 |
[Arduino] Arduino Basic and control button and LEDs (0) | 2017.01.08 |