arduino/flash/pir motion senso

hello everyone and thank you for the help i've received so far on this site,

i am trying to create an object that controls flash based on motion detection.

what i have so far is:

a pir sensor connected to digital pin 2, ground, and 5v on a duemilanove loaded with firmata standard connected via usb to a win32 pc running serproxy and flash cs4 with the as3glue libraries. flash is where my problem begins, as i am not familiar with as3.

what i have so far is:

import net.eriksjodin.arduino.Arduino;
import net.eriksjodin.arduino.events.ArduinoEvent;
import flash.events.MouseEvent;

var arduino = new Arduino("127.0.0.1", 5331);
var ledPin:Number = 13;
var pin:Number = 2;
arduino.setPinMode(pin, Arduino.INPUT);

// when Arduino reboots, Firmata firmware sends its version to indicate startup
arduino.addEventListener(ArduinoEvent.FIRMWARE_VERSION, onArduinoStartup)
// Arduino initialization
function onArduinoStartup(e:ArduinoEvent):void {
   arduino.setPinMode(ledPin, Arduino.OUTPUT);
   arduino.writeDigitalPin(ledPin, Arduino.LOW);
   trace("Arduino initialized.");
   arduino.writeDigitalPin(ledPin, Arduino.HIGH);
   arduino.getDigitalData(pin);
   trace("Digital pin " + e.pin + " on port: " + e.port +" = " + e.value);
   arduino.addEventListener(ArduinoEvent.DIGITAL_DATA, onReceiveDigitalData);
}

arduino.addEventListener(ArduinoEvent.DIGITAL_DATA, onReceiveDigitalData);

function onReceiveDigitalData(e:ArduinoEvent):void {
trace("Digital pin " + e.pin + " on port: " + e.port +" = " + e.value);
}

which returns:

Arduino initialized. Digital pin 0 on port: 5331 = 1

in the output. So I guess its good that the arduino is being read properly, but I thought that the pir would return HIGH or LOW and furthermore its on pin 2.

Basically my question is how do I read digital pins from within flash repeatedly or when they change and store their value?

thanks, and forgive my ineptitude.

gazaa

actually i figured it out. ill post the setup and as if anyone is interested

hi have you posted the setup,if so where ? and do you remember what was the model of pir sensor have a nice day