keyestudio
www.keyestudio.cc
107
Sample program B
:
//////////////////////////////////////////////////////////
#include <Servo.h>// define a header file. Special attention here, you can call the servo function
directly from Arduino's software menu
bar Sketch>Importlibrary>Servo, or input #include <Servo.h>. Make sure there is a space
between #include and <Servo.h>. Otherwise, it will cause compile error.
Servo myservo;// define servo variable name
void setup()
{
myservo.attach(9);// select servo pin(9 or 10)
}
void loop()
{
myservo.write(90);// set rotate angle of the motor
}
//////////////////////////////////////////////////////////
Above are the two methods to control the servo. You can choose either one according to your liking or
actual need.
Summary of Contents for Basic starter kit
Page 1: ...1 ...
Page 10: ...keyestudio www keyestudio cc 8 Connection for 2560 R3 ...
Page 17: ...keyestudio www keyestudio cc 15 Connection for 2560 R3 ...
Page 21: ...keyestudio www keyestudio cc 19 Connection for 2560 R3 ...
Page 25: ...keyestudio www keyestudio cc 23 Connection for 2560 R3 ...
Page 29: ...keyestudio www keyestudio cc 27 Connection for 2560 R3 ...
Page 39: ...keyestudio www keyestudio cc 37 Connection for 2560 R3 ...
Page 62: ...keyestudio www keyestudio cc 60 Connection for 2560 R3 ...
Page 66: ...keyestudio www keyestudio cc 64 Connection for 2560 R3 ...
Page 77: ...keyestudio www keyestudio cc 75 Manual for LED segment display ...
Page 78: ...keyestudio www keyestudio cc 76 Connection for R3 Connection for 2560 R3 ...
Page 90: ...keyestudio www keyestudio cc 88 Connection for 2560 R3 ...
Page 94: ...keyestudio www keyestudio cc 92 ...
Page 95: ...keyestudio www keyestudio cc 93 Connection for R3 Connection for 2560 R3 ...