Stone and I decided to make a basketball catapult as our project.  The idea is that a ball is tossed from the catapult into a netting or bucket, as in basketball, when a sensor is triggered.

(Our catapult – made from a base, a lens, a lens holder, and two squares designed with a hole in the center to allow essentially frictionless movement of the catapult)

(Our servo that will be used to stimulate the catapult)

(All together now)

 


#include <Servo.h>
const int SERVO_PIN = 9;
Servo wiggling_servo;
int x = 0;

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
wiggling_servo.attach(SERVO_PIN);
}

void loop() {
if(x < 1){
wiggling_servo.write(0);
delay(50);
wiggling_servo.write(90);
delay(50);
wiggling_servo.write(180);
delay(100);
wiggling_servo.write(0);
x++;
}
}