As computing becomes more ubiquitous in our objects, designers need to be more aware of how to design meaningful interactions into electronically enhanced objects. At the University of Washington, a class of junior Interaction Design majors is exploring this question. These pages chronicle their efforts.

Thursday, June 9, 2016

10) Dillon and Dwight - Final Video


Scoots is an infrared motion tracking spotlight designed to follow users with an infrared wearable tech. Scoots adds a dynamic element to stage performances and presentations without needing a spotlight operator.

The Final Video

Scoot's spherical design allows for a seamless 360 range of motion, giving the illusion of the head gliding over the body.
Infrared sensors on the head piece track the user's motion in each direction.
The simple design keeps the complex inner workings from view to create a sleek aesthetic.


FINAL CODE

#include  <Servo.h>;

Servo servoVert;
Servo servoLat;

int latCount = 0;

int currentLat = 0;

String LatDir = "";
String VertDir = "";
String light = "";

int joy1 = 0;
int joy2 = 0;

int servoLatWrite = 0;
int servoVertWrite = 0;

int ledRight = A3;
int ledLeft = A2;
int ledUp = A0;
int ledDown = A1;

int ledRightRead = 0;
int ledLeftRead = 0;
int ledUpRead = 0;
int ledDownRead = 0;

void setup() { 

  Serial.begin(9600);

  servoVert.attach(5);
  servoLat.attach(3);

  pinMode(10, HIGH); //light
  pinMode(11, HIGH); //failsafe if lat rotates too far

}

//________________________________________________________________________________
//________________________________________________________________________________
//________________________________________________________________________________

void loop() {

//_____________________________________________
//CALIBRATE VALUES TO SENSOR LEVELS

  ledRightRead      = analogRead(ledRight);
  ledLeftRead       = analogRead(ledLeft);
  ledUpRead         = analogRead(ledUp);
  ledDownRead       = analogRead(ledDown);

  //for joystick demo
  //joy1              = analogRead(4);
  //joy2              = analogRead(5);

//_____________________________________________
//FIND MAX B/T EACH DIRECTION, ADJUST ANGLE, PRINT DIRECTIONS TO SERIAL MONITOR

  //Lateral Motion

  if (ledLeftRead - ledRightRead > 50) {
    servoLatWrite = 93;
    LatDir = "RIGHT";
    latCount -= 1;
  } else if (ledRightRead - ledLeftRead > 50) {
    servoLatWrite = 64;
    LatDir = "LEFT ";
    latCount += 1;
  }
  else {
    servoLatWrite = 83;
    LatDir = "LAT CENT";
  }

  //Vertical Motion

  if (ledUpRead - ledDownRead > 15) {
    servoVertWrite -= 5;
    VertDir = "DOWN";
  } else if (ledDownRead - ledUpRead > 15) {
    servoVertWrite += 5;
    VertDir = "UP  ";
  } else {
    servoVertWrite += 0;
    VertDir = "VERT CENT";
  }


//_____________________________________________
// FLIP LATERAL DIRECTION IF VERT ON OTHER SIDE

  if (servoVertWrite > 90) {
    if (servoLatWrite == 67) {
      servoLatWrite == 90;
    }
    if (servoLatWrite == 90) {
      servoLatWrite = 67;
    }
  }

//_____________________________________________
// LATERAL SERVO MOTOR GRADUAL ACCELERATION

  //95 to either
  if (servoLatWrite > 83) {
    for (int i = 95; i >= servoLatWrite; i--) {
      Serial.println(servoLatWrite);
     servoLat.write(i);
     delay(15);
    }

  //65 to either
  } else if (servoLatWrite < 83) {
    for (int i = 64; i <= servoLatWrite; i++) {
     servoLat.write(i);
     delay(15);
    }

    //83 down to 65
  } else if (servoLatWrite == 65) {
      for (int i = 83; i >= servoLatWrite; i--) {
        servoLat.write(i);    
      }
    //83 to 95
  } else {
    for (int i = 83; i <= servoLatWrite; i++) {
      servoLat.write(i);
    }
  }

//_____________________________________________
// WRITE ANGLES TO SERVER MOTORS

  servoVert.write(map(joy1, 280, 1014, 90, 150));
  //servoLat.write(map(joy2, 0, 640, 55, 105));

//_____________________________________________
//TURN ON LIGHT ONLY WHEN INFRARED LIGHT DETECTED

  if (LatDir == "CENT" || VertDir == "CENT") {
    digitalWrite(4, LOW);
  }
  if (ledUpRead < 600 || ledLeftRead < 600) {
    digitalWrite(4, LOW);
    light = "LOW";
  } else if (ledDownRead < 600 || ledRightRead < 600) {
    digitalWrite(4, LOW);
    light = "LOW";
  } else {
    digitalWrite(4, HIGH);
    light = "HIGH";
  }

//_____________________________________________
//CAP ALL DEGREES

    //shuts off if lat twists too far in either direction
    if (latCount > 50) {
      digitalWrite(11, HIGH);
    }

    if (latCount < -50) {
      digitalWrite(11, LOW);
    }

    if (servoVertWrite > 155) {
      servoVertWrite = 155;
    }

    if (servoVertWrite < 90) {
      servoVertWrite = 90;
    }
   
//_____________________________________________
//SERIAL PRINTING

    ledRightRead = dirOutput[0];
    ledLeftRead = dirOutput[1];
    ledUpRead = dirOutput[2];
    ledDownRead = dirOutput[3];
   
    Serial.print("ledLeft: ");
    Serial.print(ledLeftRead);
    Serial.print('\t');

    Serial.print("ledRight: ");
    Serial.print(ledRightRead);
    Serial.print('\t');

    Serial.print("ledDown: ");
    Serial.print(ledDownRead);
    Serial.print('\t');

    Serial.print("ledUp: ");
    Serial.print(ledUpRead);
    Serial.print('\t');
   
    Serial.print('\t');
    Serial.print("VertDirection: ");
    Serial.print(VertDir);
    Serial.print('\t');
   
    Serial.print("LarDirection: ");
    Serial.print(LatDir);

    Serial.print('\t');
    Serial.print(light);
    Serial.print('\t');
    Serial.print("vert angle ");
    Serial.print(servoVertWrite);

    Serial.print('\t');
    Serial.print(latCount);
    Serial.print('\t');
    Serial.print("lat angle ");
    Serial.print(servoLatWrite);
    Serial.print("Arm:  ");
    Serial.print(servo2Write);
    Serial.print('\t');
    Serial.print("Legs:  ");
    Serial.print(servo1Write);*/
    Serial.println();
   
}

No comments:

Post a Comment