Free Fall Elevator

So yeah, wasn’t really supposed to be the free fall elevator, but thats what it became. My very original idea was to make a catapult, and the point of the arduino was to note that a load was present, make the motor pull back the arm, check that there was still a load, and release the arm to fire. I also wanted to try and map the amount of pull to a distance of load travel, so that the user could tell it how far to launch something. Where did I go wrong?

Basically, the motors weren’t strong enough to pull against almost any of my springs. So idea gets re-designed.

So next I decided to make an elevator, where the user could tell the elevator to go to a specific floor, and the elevator would respond accordingly. There would be levels of state and response. For example, if you told the elevator to go to its current floor, it would ding and light up that floor’s LED. If you told it to go to another floor, it would light up the new floor’s LED and say whether it was going up or down. Since it knew where it was, it knew how far to go, whether it was going up/down one/two floors. Where did I go wrong?

Basically, it took me way too long to get to this idea, and I had a major malfunction during the night that brought the project to a halt. When this happened, I had built the elevator, and had made the elevator motors capable of both forward and reverse. Then I had just programmed the up and down buttons when my computer crapped out.

Below are some photos and the code. Obviously the code isn’t the final product, but what I had when I had to stop.

 

Here is my code:
 
int motorPinA = 8;                // LED connected to digital pin 13
int motorPinC = 9;
int motorPinB = 10;
int motorPinD = 11;
int signalPinUp = 3;
int signalPinDown = 2;
int valUp = HIGH;
int valDown = HIGH;

 
void setup()                    // run once, when the sketch starts
{
  pinMode(motorPinA, OUTPUT);      // sets the digital pin as output
  pinMode(motorPinB, OUTPUT);
  pinMode(motorPinC, OUTPUT);
  pinMode(motorPinD, OUTPUT);
  pinMode(signalPinUp, INPUT);
  pinMode(signalPinDown, INPUT);
  //Serial.begin(9600);
 
}
 
void runUp() {
  digitalWrite(motorPinA, HIGH);   // sets motor to forward
  digitalWrite(motorPinB, LOW);
  digitalWrite(motorPinC, LOW);
  digitalWrite(motorPinD, HIGH);
}
 
void runDown() {
  digitalWrite(motorPinA, LOW); 
  digitalWrite(motorPinB, HIGH);
  digitalWrite(motorPinC, HIGH);
  digitalWrite(motorPinD, LOW);  
}
 
 
void loop()                     // run over and over again
{
  valUp = digitalRead(signalPinUp);  // read input value
  valDown = digitalRead(signalPinDown);
  //Serial.println(val);
  if (valUp == HIGH && valDown == HIGH) {
  digitalWrite(motorPinA, LOW);    // sets motor to reverse
  digitalWrite(motorPinB, LOW);
  digitalWrite(motorPinC, LOW);
  digitalWrite(motorPinD, LOW);    
  }
  
  if (valUp == LOW) {
    runUp();
    valUp = HIGH;
    valDown = HIGH;  
  }
  if (valDown == LOW) {
    runDown();
    valUp = HIGH;
    valDown = HIGH;
  }
}

Advertisements

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