Tuesday, December 24, 2013

Final and Beyond

High Fidelity is a kinetic sound and sculptural work by William Tucci. In the DIAP physical computing class I hoped to improve on this work by restructuring the code with switch case statements and optimized randomization. A full semester later I have yet to resolve these issues stay tuned more improvements to come!

http://www.youtube.com/watch?v=9ZITS1iyRXU

Arduino code in progress:


#include <Servo.h>

Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;

int pos = 0;

void setup(){
  Serial.begin(9600);
  servo1.attach(3);
  servo2.attach(4);
  servo3.attach(5);
  servo4.attach(6);
}

void loop() {
  switch (range) {
  case 0:
  sweep(servo1, 1, 80, 120, 30);
  break,
  case 1:
  sweep(servo2, 1, 80, 160, 15);
  break,
  case 2:
  sweep(servo3, 1, 100, 160, 15);
  break,
  case 3:
  sweep(servo4, 1, 60, 140, 15);
  break,
}

void sweep(Servo s, int inc, int smin, int smax, int del){
  for(int pos=smin; pos < smax; pos += inc){
    s.write(pos);
    delay(del);
  }
}


No comments:

Post a Comment