37 lines
623 B
C++
37 lines
623 B
C++
#include <Servo.h>
|
|
|
|
const int PIN_SERVO = 9;
|
|
Servo servo;
|
|
|
|
/*
|
|
----------------------------------------------------
|
|
Servo - Arduino
|
|
-
|
|
Red - 5V
|
|
Black - GND
|
|
Yellow - PWM Pin (9 in this example)
|
|
|
|
Using TowerPro SG-5010 - default 93
|
|
TowerPro MG-995 -
|
|
as servos for development
|
|
----------------------------------------------------
|
|
*/
|
|
|
|
void setup() {
|
|
Serial.begin(57600);
|
|
Serial.flush();
|
|
|
|
Servo_init();
|
|
}
|
|
|
|
void loop() {
|
|
|
|
}
|
|
|
|
void Servo_init () {
|
|
servo.attach(PIN_SERVO);
|
|
int angle = servo.read();
|
|
Serial.print("Default angle: ");
|
|
Serial.println(angle);
|
|
}
|