Plant saver!

Assignment: DC Motor: Actuation Assignment 1

Collaborators:

Assignment: DC Motor: Actuation Assignment 1
Collaborators:

 

See "deadplant" attachment for a photo of what happened to my last plant.

It died, and now I"m worried I'll have no more luck and get caught in an earthquake.

 

Thus, for my TUI assignment this week I created a plant rotator which rotates the plant. Ie. a lazy susan for plants. Of course it could be used as a lazy susan but my apartment is so small I have no need for a table, much less a table accessory.

 

 

Materials used:

cardboard

tape

battery holder

2 AA batteries

wires

transitor

breadboard

arduino

10k resister

diode

 

CODE:

 

/* Adapted by Hazel from:

* An open-source clock for Arduino.

* (cc) by Rob Faludi

* http://www.faludi.com

* http://creativecommons.org/license/cc-gpl

* one pot fades one led

* modified version of AnalogInput

* by DojoDave <http://www.0j0.org>

* http://www.arduino.cc/en/Tutorial/AnalogInput

*/

 

int second=0, minute=0, hour=0;; // declare time variables

// these time variables are declared globally so they can be used ANYWHERE in your program

 

int potPin = 2;   // select the input pin for the potentiometer

int ledPin = 9;   // select the pin for the LED

int val = 0;      // variable to store the value coming from the sensor

void setup() {

Serial.begin(9600);

}

 

void loop() {

//I wanted to just rotate the dc motor half a circle but couldn't figure out the correct timing to get it to work but htat

 

//val = analogRead(potPin);    // read the value from the sensor, between 0 - 1024

//static unsigned long lastTick = 0; // set up a local variable to hold the last time we moved forward one second

// move forward one second every 1000 milliseconds

//if (millis() - lastTick >= 1000) {

//lastTick = millis();

//second++;

//}

//if (second - lastTick >= 60) {

//lastTick = second;

//minute++;

//}

//if (minute - lastTick >= 60) {

//lastTick = minute;

//hour++;

//}

//if (hour=4){

//this is where I didn't know by how much to rotate the motor -- 100sec? I couldn't figure out the speed of the dc motor.

//timer=0;

//while timer<100

//}//

//Serial.println(val);

 

//so instead I just continually rotate it very slowly

analogWrite(ledPin, 30); // analogWrite can be between 0-255

//it did not work well at low levels. this was as low as it could really go.

//}

}