Cat Toy
In this indestructible we will be showing you how to build the cat toy we have design
Materials Needed
1 survo
1 breadbored
1 Aldreno uno
1 ultrasonic sencer
1 Aldreno cable
1 battery plug
1 battery
1- 100 wires
Hocking Up the Survo
so a server has three wires attached to it each being a different color (white red black) each pin has its own purpose. the wight wire will be hooked up to the pin. the red wire will go to power. the black wire will go to grown. now with the bread bore hook it up some wires to the arduino being the positive and ground wires to the rails on the bread bored. now hook up the red and black wires to there corresponding rails. then put the white pin into the pin that will be running your servo.
Hooking Up the Ultrasonic Sensor
the ultrasonic sensor has 4 mins to it vcc which is the power pin, there is the Gnd which is ground, trig , and echo. so to start connect some wires to the 4 pins then hook up the power to the positive rail on the bread bored and the ground to the ground rail. then plug the echo and trig pins in to the pin that where set to in this case 7 is echo and 6 is trig.
Code for Aldrino
/***********************************************
************************************************/
Servo servo; //create servo object to control a servo
/************************************************/
long duration;
int distance;
const int trig = 6;
const int echo = 7;
void setup() {
pinMode(trig, OUTPUT); // Sets the trig as an Output
pinMode(echo, INPUT); // Sets the echo as an Input
Serial.begin(9600); // Starts the serial communication
servo.attach(9);//attachs the servo on pin 9 to servo object
}
/*************************************************/
void loop() {
digitalWrite(trig, LOW);
delayMicroseconds(2); // Sets trig HIGH for 10 micro seconds
digitalWrite(trig, HIGH);
delayMicroseconds(10);
digitalWrite(trig, LOW);
duration = pulseIn(echo, HIGH);
distance = duration * 0.034 / 2;
if (duration >= 2500 ) {
servo.write(0);
}
else
{
servo.write(80); //goes to 80 degrees
delay (2000);
distance = 10000;
}
Making Shell
part 1: cut out 2 circles with a radiance of 13 cm
Part 2: now cut out a 5 cm wide rectangular stripe to go around one of the circles then glue it to said circles
part 3: now cut out a smaller hole that is the diameter of a toilet paper role in the center of opposite circle
part 4: now stick a paper towel role in the hole with 20 cm sticking out the top and glue it in
part 5: now take another paper towel role and cut it straight down length wise then stick it to fit in the first role
part 6: now poke a hole the size of a dowel in near the top side of the inner role
part 7: now put a dowel in that hole
part 8: now tie a string to the side that is away from the case
part 9: then in the rectangular piece of the base cut out a hole to fit the ultrasonic censer
part 10: then put aduino in and close it in a fation that makes the ultrasonic censer fit in the cut out and the servo is in the center connecting to the inner paper towel role