Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Surilli
Published © LGPL

Servo Motor Control Using Surilli Basic M0

Build your own door lock, automatic trash can, or control a robotic arm using micro servo SG90 and Surilli Basic M0.

BeginnerFull instructions provided20 minutes598
Servo Motor Control Using Surilli Basic M0

Things used in this project

Hardware components

Jumper wires (generic)
Jumper wires (generic)
×3
Servos (Tower Pro MG996R)
×1
Surilli Basic
Surilli Basic
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Servo Motor Control Using Surilli Basic M0

Code

Servo_Motor

C/C++
#include <Servo.h>
Servo myservo;                   // create servo object to control a servo
                                 // twelve servo objects can be created on most boards
int pos = 0;                     // variable to store the servo position
void setup() {
 myservo.attach(A1);             // attaches the servo on pin A1 to the servo object
}
void loop() {
 for (pos = 0; pos <= 180; pos += 1) 
                             // goes from 0 degrees to 180 degrees in steps of 1 degree
{ 
   myservo.write(pos);              // tell servo to go to position in variable 'pos'
   delay(15);                       // waits 15ms for the servo to reach the position
 }
 for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
   myservo.write(pos);              // tell servo to go to position in variable 'pos'
   delay(15);                       // waits 15ms for the servo to reach the position
 }
} 

Credits

Surilli
196 projects • 65 followers
Surilli is a premiere Internet of Things centric Technology Company aimed at providing cutting edge innovative solutions.
Contact

Comments

Please log in or sign up to comment.