Making Things Interactive

February 20, 2008

Assignment 5, 6: Solar Power

Filed under: 5: Making Motion,6: More Motion,Assignments,Thomas Hendrickson — tphendrickson @ 7:52 pm

So after a ton of trying, troubleshooting, finding help from friends, I finally got a transistor connection to work and got two DC motors running together off of a code. One motor spins a sun and after it powers up the plants (a 6 second delay from a incremented counter), the flowers spin on the other motor.

here is the code:

int sunPin = 7;        //sun motor pin
int flowerPin = 5;     //flower motor pin
int ledPin = 13;       //led runs as a check
int counter = 0;       //counts how long program has been running</code>

void setup()
pinMode(ledPin, OUTPUT);
pinMode(sunPin, OUTPUT);
pinMode(flowerPin, OUTPUT);


void loop()

digitalWrite(sunPin, HIGH);    //turns on sun immediately

if (counter == 6)              //checks counter value
digitalWrite(flowerPin, HIGH);  //if counter high enough, turns on led and flower
digitalWrite(ledPin, HIGH);

counter++;      //if not long enough, counter is incremented
delay(1000);    //1 second delay


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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

Blog at

%d bloggers like this: