Making Things Interactive

February 19, 2008

Solenoid/Servo Target Shooter

Filed under: 6: More Motion,Assignments,Christopher Bridgman — cbridgma @ 2:00 am

So, for this assignment, i wanted to create a target shooting device out of the solenoid so it would hit a target on the servo motor. i guess this was my interpretation of making the components do something. So here it finally is. This was done by using a simple tilt switch to fire the solenoid to try and hit the servo motor which operated off a simple time delay. However, after hooking all of this stuff up together, the sensor responded very slowly and im not sure why. It made it hard to actually hit the target. But anyways, here is the video.

int statusPin = 13;                // LED connected to digital pin 13
int switchPin = 6;                 // Gravity switch connected to pin 6
int servoPin = 11;                 //servo connected to pin 11
int solenoid = 2;                 //solenoid connected to pin 2
int val;

void setup()                    // run once, when the sketch starts
  pinMode(statusPin, OUTPUT);      // sets the digital pin as output
  pinMode(servoPin, OUTPUT);       //sets the analog pin as output
  pinMode(solenoid, OUTPUT);       //sets the digital pin as output
  pinMode(switchPin, INPUT);       //sets the digital pin as input

void loop()                     // run over and over again
  val = digitalRead(switchPin);

  Serial.print("Value: ");

  if (val == 1)
  if (val == 0)
    digitalWrite(statusPin, LOW);

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at

%d bloggers like this: