Making Things Interactive

February 24, 2008

Assignment 6: Making more motion (actuation)

Filed under: 6: More Motion,Siddartha Butalia — sbutalia @ 2:28 pm

So i tried to build on my DC motors from last week. I simplified the sensors to a switch to focus on building other components. I aimed to slow down the DC motor by using a rubber band setup. This was not as seccesfull, but i learned how hard it was to prototype details with foam core. the code is a simple algorithm which takes a switch input, and drives a motor

 here are some photos & the code:

Free Image Hosting at www.ImageShack.us Free Image Hosting at www.ImageShack.us


int ledPin = 13;    // defines the check pin
int inputPin = 2;   // defines input for sensor A
int motorPin = 9;   // defines output for motor A

void setup() {

  pinMode(ledPin, OUTPUT);      // declare check LED Pin
  pinMode(motorPin,OUTPUT);     // declare Motor PinA
  pinMode(inputPin, INPUT);     // declare SensorA input Pin

  Serial.begin(9600);
 }

void loop(){

  while (digitalRead(inputPin) == HIGH) {        // check if the input is on
    digitalWrite(ledPin, HIGH);   // turn check LED On
    digitalWrite(motorPin,HIGH);  // turn Motor A On
  } 

    digitalWrite(ledPin, LOW);  // turn check LED Off
    digitalWrite(motorPin,LOW); // turn Motor A Off

}

 


		
Advertisements

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:

WordPress.com Logo

You are commenting using your WordPress.com 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

Create a free website or blog at WordPress.com.

%d bloggers like this: