Arduino Skull With Moving Mouth
by uptownkitten453 in Circuits > Arduino
1274 Views, 4 Favorites, 0 Comments
Arduino Skull With Moving Mouth
Supplies needed
*Arduino module (I have an Arduino Mega 2560, but any module with PWM will work)
*Drill
*Drill bit(s)
*Paperclip
*Servo
*& type b usb
Drill a Hole Big Enough for Your Paperclip on Whatever Side of the Jaw You Want the Servo & Paperclip to Be Mounted Onto.
Shape Your Paperclip to Fold Onto the Servo/clip Onto & to Make the Other End Bent to Fit on the Jaw to Control the Movement.
I can't provide a picture of the servo, because it is mounted onto a box for another project.
Wiring
Attach the signal pin of the servo to a PWM pin (for Mega 2560 it's pin 9). Attach the positive end of the servo to the INDEPENDENT power source. Attach BOTH the GND of the Arduino & GND of the power source to the servo's GND.
Code (I Have No Credit to the Code FIY)
//www.elegoo.com
//2016.12.08
#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(9); // attaches the servo on pin 9 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
}
}