We had a Pure Data workshop with Ed Kelly and I found it to be invaluable. My main goals for this workshop where to:
1) Modify the existing Ultrasonic sensor code to get two sensors working with the Arduino
2) Work out how to split the sensor data within Pure Data to gain independent control over both the sensors (very important for functionality of the installation!)
I had some code that was for using multiple Ping sensors, the problem was that both sensors would only send a single echo pulse when activated, obviously I needed this process to be repeated continuously and as Ed was a very busy man trying his best to get everyone up and running using an Arduino and Pure Data (no mean feat!) Tim had a little look for the code for me.
He established that it was it a bit of an odd order, the main problem being that the ‘void loop’ command (the message that tells the program to repeat a certain section of code) was in the wrong place. Tim’s help along with a contribution from Ed meant that we eventually managed to get both sensors working with both LED’s blinking nicely.
Now for phase two…….
Firstly I must state that main problem here was that I was receiving two sensors data within one number box in Pure Data. This meant that control over what the sensors manipulate, video and audio wise, would be erratic at best. The solution was to split the data into two number boxes so they would not affect each other’s readings and be able to be used independently of one another.
Ed’s first idea was to tell one sensor to add 100000 to its total, this would mean that the two sensors would still be contained within one number box in Pure Data but the data readings would be so different, because one reading would be 100000 higher than the other, that in theory you could use the sensor data independently.
A good idea but unfortunatly this led to the visuals being even more difficult to control because the [threshold] objects (the objects that determine at what distance events happen) Where being doubly confused by the erratic changes in numbers.
Now enter Alfonso….
Alfonso graduated from Digital Arts last year and used the exact same sensors with Pure Data for his final project. His piece used one sensor but he did give me some patches that seemed to be set up for multiple sensors (although he had never tested them)
I loaded in a patch and to my surprise the sensors split themselves into two boxes. At first I thought that this was it! yet on closer inspection the data was very erratic. The terminal in Pure Data was saying that it was receiving data from sensor (1) then sensor (2) then sometimes a multiple of both and at other times just sent one sensors reading multiple times. Ed said that he and Alfonso had the same problem last year and that they never worked it out… then Ed had an epiphany.
He used a combination of trigger and float objects to split the signal, then printed the new signals out and either an ‘A’ or a ‘B’ for the terminal to comprehend. This rectified the data flow and we finally had total control over both sensors… hell yeahJ
Here’s a look at the patch so far. This uses 3 videos. One of which only plays when there is no presence within the space. The other two play as a composite when an individual enters the space.