Skip to content

4 22 18 meeting notes

Max Lever edited this page Apr 28, 2018 · 6 revisions

Sunday, April 22

Sarah

  • troubleshooting pulleys Tracey, Max
  • made 2 molds
  • made 5 clear resin barnacles Rayyan, Tracey, Max
  • painted frame and other stuff with brand blue paint Rayyan
  • prepare and design process book & presentation Max
  • converted processing code to arduino for lights
const int ledPins[12] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
int ledRel[4][3] = {
                    {2,3,4},
                    {5,6,7},
                    {8,9,10},
                    {11,12,13}
                    };
float distances[4][3] = {
                    {0,0,0},
                    {0,0,0},
                    {0,0,0},
                    {0,0,0}
                    };
float h = 3;
float w = 4;
float maxDistance;
int n = 0;


float dist(float x1, float y1, float x2, float y2) {
  return float(sqrt(sq(x1 - x2) + sq(y1 - y2)));
}

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

  for (int i = 0; i < sizeof(ledPins) / sizeof(int); i++) {
    pinMode(ledPins[i], OUTPUT);
  }
  maxDistance = dist(w / 2, h / 2, w, h);
  for (int y = 0; y < int(h); y++) {
    for (int x = 0; x < int(w); x++) {
      float distance = dist(w/2, h/2, x, y);
      distances[y][x] = (distance / maxDistance) * 255;
      Serial.print("x");
      Serial.println(x);
      Serial.println(y);
      Serial.println(distance);
      Serial.println(maxDistance);
      Serial.println(distances[x][y]);

    }
  }
}

void loop() {  
  n = (n + 1) % 100;
  lights();

  delay(50);
}

void lights() {
  for (int i = 0; i < sizeof(ledPins) / sizeof(int); i++) {

   int func = distances[(i - i%4) / 4][i%4];
    analogWrite(ledPins[i], func);
  }
}
Clone this wiki locally