Creative Physical Computing

Updates from Abe Smith RSS

  • 01:56:03 pm on July 15, 2008 | 0 | # |
    Tags: , ,

    A test in developing interfacing with computers using colour.
    Hacked a few example patches together in max msp to make colour level control shape distortion

     
  • 01:22:36 pm on July 11, 2008 | 0 | # |

    I’ve hacked a pong flash game to be controlled using two potentiometers going into the analogue inputs on the Arduino board. The set up was just a test in combining different technologies but one use for it is that it could allow for multiple responsive controllers on internet flash applications and games.

     

    Here’s a Video.

     

     

    The main challenge of getting this to work was translating the jittery signal from the Arduino into a smooth and fluid movement in flash.

     

    I separated the values from the different controllers by adding 257 to the second input in Arduino. Then once id identified the different feeds in flash I gave the second value a different name and subtracted the 257 back off again.

     

    I achieved the smooth and fluid movement by using action script to store the incoming signals into 2 arrays and creating an average of each array which id use as the value to control the behavior of objects in flash.

     

    Here’s a section of the AS2 code I wrote that did this (for just one of the values)

     

    // fills array for value1

    function loop1() {

                // need to store data values  e.g. store[arrayPointer] = data

                dataArray[arrayPointer] = _root.mc_square._xscale;

                arrayPointer = (arrayPointer+1);// adds 1 to arrayPointer each loop

                //trace(arrayPointer);

                _root.createAvg();

                _root.divideAvg();

                // if arrayPointer is a number the same as or greater than the length of the array

                if (arrayPointer>=dataArray.length) {

                            arrayPointer = 0;// resets arrayPointer back to 0

                }

    }

     

    // gets average value from array and makes the var avg equal to it.

    function createAvg() {

                for (var i:Number = 0; i<dataArray.length; i++) {

                            //trace(dataArray[i]);

                            avg = avg+(dataArray[i]);

                }

    }

     

    // divides the average by the length of the array and outputs it

    function divideAvg() {

                avg = Math.round(avg/dataArray.length);

                _root.mc_square2._xscale = (avg);

                // make paddles = new averaged values

     

                 _root.p._y  = (avg);

    }

     

    Another main problem I found was flash didn’t seem to treat the incoming xml socket data as an integer so to get it as a value I could use in my equation I linked the scale of an invisible movie clip on stage to the value of data and then used this movie clips properties in my calculations.

     
  • 10:51:14 pm on July 8, 2008 | 0 | # |

    Iv been working on getting flash to read two values from the arduino to allow for creating applications with 2 potentiometer inputs. Iv only been able to send one value to flash so iv created a sequence of 2  different ranges that arduino cycles through for the different analogue inputs. Flash then checks which range the value is in and uses it to control 2 different movie clips.

    heres the relevant section  of the  code for arduino and flash.

    Arduino Code

    int firstSensor = 0;    // first analog sensor
    int secondSensor = 0;    // second analog sensor
    void setup()
    {
      Serial.begin(9600);}
    void loop()
    {
        firstSensor = analogRead(0)/4;
        delay(10);
        Serial.print(firstSensor, DEC);
        Serial.print(0, BYTE);         
      delay (50);
      secondSensor = analogRead(1)/4;
        delay(10);
        Serial.print(secondSensor + 257, DEC);// adding 257 meens its in the second range in flash
        Serial.print(0, BYTE);         
      delay (50);
    }

    Flash AS2 code

    serialServer.onData = function(data) {
        if (data<=256) {
     _root.mc1._y =10*(data) – 400   ;
       
     } else if (data>256) {
     _root.mc2._y = ((data) – 257);
     }
          };

     
  • 06:14:37 pm on July 7, 2008 | 0 | # |

    I’ve assembled and soldered the ¨TV-B-Gone¨ kit consisting of a Microcontroller outputed to high powered infra red L.E.D’s. It works on some TVs but not on others. For more details checkout http://www.ladyada.net/make/tvbgone/ (includes an epic video of the kit in use!)