SG90 Camera Mount [B051]
https://www.youtube.com/watch?v=gk7Mg69mgq4
* GitHub : https://github.com/rdiot/rdiot-b051.git
* Specs
Weight : 0.050kg (0.11lb.)
Size : 13cm x 9cm x 8cm (5.12in x 3.54in x 3.15in)
* Contents
- Connect
Top ----- D12
Bottom ----- D11
- Key Code
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Servo.h>
LiquidCrystal_I2C lcd(0x27,20,4);
Servo myservo1;
Servo myservo2;
int servoPin_updown = 12;
int servoPin_leftright = 11;
int pos_updown = 0;
int pos_leftright = 0;
void setup()
{
lcd.init(); // initialize the lcd
lcd.backlight();
lcd.print("start LCD2004");
myservo1.attach(servoPin_updown);
myservo2.attach(servoPin_leftright);
delay(1000);
lcd.clear();
}
void loop()
{
lcd.setCursor(0,0);
lcd.print("B051:SG90 Mount");
for(pos_leftright = 0; pos_leftright < 180; pos_leftright += 1)
{
myservo2.write(pos_leftright);
//lcd.setCursor(0,1);
//lcd.print("pos0~179=" + (String)pos + " " );
delay(10);
}
for(pos_leftright = 180; pos_leftright>=0; pos_leftright-=1)
{
myservo2.write(pos_leftright);
//lcd.setCursor(0,2);
//lcd.print("pos180~1=" + (String)pos + " " );
delay(10);
}
for(pos_updown = 80; pos_updown < 180; pos_updown += 1)
{
myservo1.write(pos_updown);
//lcd.setCursor(0,1);
//lcd.print("pos0~179=" + (String)pos + " " );
delay(10);
}
for(pos_updown = 180; pos_updown>=80; pos_updown-=1)
{
myservo1.write(pos_updown);
//lcd.setCursor(0,2);
//lcd.print("pos180~1=" + (String)pos + " " );
delay(10);
}
}
'3) Actuator > Motor' 카테고리의 다른 글
4-Phase 5-Wire Stepper Motor (28BYJ-48) [D021] (0) | 2016.10.04 |
---|---|
TowerPro SG5010 Micro Servo (SG5010) [D032] (0) | 2016.10.04 |
Tower Pro SG90 Micro Servo (SG90) [D018] (0) | 2016.10.04 |
Helicopter Coreless DC Motor [S143] (0) | 2016.09.30 |
DC6~12V R030 Biaxial Double Axis DC Motor (R030) [D067] (0) | 2016.09.30 |