Group Google Calendar

Wednesday, November 19, 2014

Full Group Meeting (11/19)- Little Bit of Everything

Summary: Assembling the body, finishing designs, and started coding.

We finished assembling our prototype body:

 Modeled more of the components:

We worked on finishing our slides for the presentation. See the Google Drive.

We began writing some demo code for the lifting mechanism, right now the motors do not turn in unison. I think it is because the first runs for 200 steps before the second one starts, but this is a start:

*************************************************



#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver.h"

Adafruit_MotorShield AFMS = Adafruit_MotorShield();
// Motor on M1 and M2
Adafruit_StepperMotor *BMotor = AFMS.getStepper(200, 1);
// Motor on M3 and M4
Adafruit_StepperMotor *FMotor = AFMS.getStepper(200, 2);

int UP = FORWARD;
int DOWN = BACKWARD;
int SPEED = 50;

void setup() {
 
  AFMS.begin();
}

void loop() {
 
  //Lift Up 
  BMotor->setSpeed(SPEED);
  FMotor->setSpeed(SPEED);
 
  BMotor->step(200,UP,DOUBLE);
  FMotor->step(200,UP,DOUBLE);
 
  delay(2000);
 
  //Hold Position
  BMotor->setSpeed(0);
  FMotor->setSpeed(0);
 
  delay(2000);
 
  //Lower Down
  BMotor->setSpeed(SPEED);
  FMotor->setSpeed(SPEED);
 
  BMotor->step(200,DOWN,DOUBLE);
  FMotor->step(200,DOWN,DOUBLE);
 
  delay(2000);
 
  //Hold Position
  BMotor->setSpeed(0);
  FMotor->setSpeed(0);
 
  delay(2000);
}


*************************************************

(NOTE: You need the libraries I added to the Google Drive in order for this to work, unzip and place the whole folder inside C:\Users\Name\Documents\Arduino\libraries, this also contains a great example for using multiple motorshields together.)

No comments:

Post a Comment