Fire Dragon 4-16-13

Today for Extend-A-Arm (EAA),

Zainab worked on the modelling the crutches and trying to determine where it would be best to place the controls and EAA on the crutches. Updated and improved how the object that EAA picks up will be delivered to Tawn etc. Came up with some moving forward question that needs to be looked at moving forward with the production of the EAA.

Wilson and Filipa worked on and updated the code for the controls and movement of EAA. They have made improvements in making the controls works as they need to.

CODE HERE:

// Store the Arduino pin associated with each input
#include // include the servo library

// JOYSTICK controll
Servo servoMotor; //creates an instance of the servo object to control a servo
int analogPin = 0; // the analog pin that the sensor is on
int analogValue = 0; // the value returned from the analog sensor
const byte PIN_ANALOG_X = 0; // right-left controll
const byte PIN_ANALOG_Y = 1; // will not be using this one for now
const byte PIN_BUTTON_SELECT = 2; // Select button is triggered when joystick is pressed
int val;

// BUTTON controll
Servo servoMotor2;
const byte PIN_BUTTON_RIGHT = 3;
const byte PIN_BUTTON_UP = 4;
const byte PIN_BUTTON_DOWN = 5;
const byte PIN_BUTTON_LEFT = 6;

////////////////////////////////////////////////////////////////

void setup() {
Serial.begin(9600);

// Specify each pin connected to a pushbutton as an input.
// Also enable the Arduino’s internal “pull-up” resistors
// for each pushbutton we want to read–this means the shield
// doesn’t need to have resistors on it.
// Note that when a pull-up resistor is used on a pin the
// meaning of the values read are reversed compared to their
// usual meanings:
// * HIGH = the button is not pressed
// * LOW = the button is pressed

pinMode(PIN_BUTTON_RIGHT, INPUT);
digitalWrite(PIN_BUTTON_RIGHT, HIGH);

pinMode(PIN_BUTTON_LEFT, INPUT);
digitalWrite(PIN_BUTTON_LEFT, HIGH);

pinMode(PIN_BUTTON_UP, INPUT);
digitalWrite(PIN_BUTTON_UP, HIGH);

pinMode(PIN_BUTTON_DOWN, INPUT);
digitalWrite(PIN_BUTTON_DOWN, HIGH);

pinMode(PIN_BUTTON_SELECT, INPUT);
digitalWrite(PIN_BUTTON_SELECT, HIGH);

servoMotor.attach(8);
servoMotor2.attach(9);
}

////////////////////////////////////////////////////////////////

void loop() {
// Print the current values of the inputs (joystick and
// buttons) to the console.
Serial.print(“l:”);
Serial.print(digitalRead(PIN_BUTTON_LEFT));
Serial.print(” “);

Serial.print(“r:”);
Serial.print(digitalRead(PIN_BUTTON_RIGHT));
Serial.print(” “);

Serial.print(“u:”);
Serial.print(digitalRead(PIN_BUTTON_UP));
Serial.print(” “);

Serial.print(“d:”);
Serial.print(digitalRead(PIN_BUTTON_DOWN));
Serial.print(” “);

Serial.print(“x:”);
Serial.print(analogRead(PIN_ANALOG_X));
Serial.print(” “);

Serial.print(“y:”);
Serial.print(analogRead(PIN_ANALOG_Y));
Serial.print(” “);

Serial.print(“s:”);
Serial.print(digitalRead(PIN_BUTTON_SELECT));
Serial.print(” “);

Serial.println();

val = analogRead(PIN_ANALOG_X); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
servoMotor.write(val); // sets the servo position according to the scaled value
delay(15);

if (PIN_BUTTON_LEFT==LOW)
{
servoMotor2.write(0);
}
}

Omar and Ivan worked on the the scissor like movement of EAA when extending, delivering object to user and retracting. They created a cardboard model to help them better understand how all the movements will work.

Next Week Goal:
To start creating and putting together the actual product instead of just prototypes

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