Category Archives: Stonehouse

IDAT106- XML Parsing

After several hours I’ve managed to cobble together some actionscript 3 to parse the XML information outputted by the program we are using.

xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest("data.xml"));

function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
Parse(xmlData);
}

This loads and reads the XML document and sends it to be Parsed.

This is the start of the code seeks out data by its tags and puts it into array. An if statement is used for each tag and i++; is used within the last if to cycle the array index.

var address = new Array(); ...

function Parse(Input:XML):void {
var Children:XMLList = Input.item.children();

for each (var Info:XML in Children) {

if (Info.name() == "address") {
address[i] = Info;
}
...

Inorder to load date information which comes in this form: 4/03/2010 11:53:33, into a form the times can be compared to find the greatest and lowest of all of them I used substring to extract them and then joined the data back together.

Fdetect[i] = temp.substring(11,13) + temp.substring(14,16) + temp.substring(17,19);

if (Fdetect[i] <>
style="font-size:78%;">Earliest = Fdetect[i];
}

If the current value is less then the stored lowest value then it replaces it. This allows me to automatically find the earliest and latest time for all of the data which is useful for visually representing it.

IDAT106

After weighing up the benefits of both ways of doing our project we have decided that the use of Arduino, though exciting, is over complex and that collecting the data using a laptop will allow us to focus on the visual element of our project.

After various inquiries using ardiuno for this project is possible however the original intention and motivation to have a number of small units left unattended is not achievable.

I will continue to post regarding Arduino as I would like to do a project using it at some point in the future.

IDAT106 – Arduino and our project

It looks like it should be possible to collect bluetooth data using an Arduino board with a bluetooth shield. This would make an idea device for recording the data as it would be small and easily portable. Looking around it seems that the most common/intended usage is for the bluetooth to be sending data rather then being used to simply scan, hopefully the hardware is flexible enough to allow this. It also appears that writing to a USB stick stick shouldn’t be too difficult.

IDAT106 – Arduino

On Wednesday we were introduced to Arduino boards are essentially general purpose programmable devices which users can experiment with and perform a wide variety of functions. Extensions known as Shields can be used to expand the unit’s functionality.

The device is programmed using a simple standardised software in a language very similar to Processing. In the session we experimented with basic programming of the device by using some code to make an LED attached to it flash on and off. I replaced the set durations with random number generating so the time delays varied. I later rewrote it so the delay between flashes would start at 1000ms and over time decend so that the rate of flashing increased.