Go Down

Topic: Read digital inputs via AS3Glue (flash) (Read 722 times) previous topic - next topic


Hey, I have a SUPER basic test program written to get digital input from the arduino. When I run the standalone monitor program that comes with as3glue, I might have to start it, close it, and start it again to get it to work, but it does work (It'd be great if anyone knew why this was happening/how to fix this as well...).

Anyways, I can NOT get my super-simple test program to take any input. I have it setting output to an LED no problem though... anyways, here's my program:

//Import the as3Glue stuff...
import net.eriksjodin.arduino.Arduino;
import net.eriksjodin.arduino.events.ArduinoEvent;

//The arduino object
var arduino:Arduino;

function setArdy(){
  arduino = new Arduino("", 5331); //Sets up new arduino with localhost over port 5331
  arduino.addEventListener(Event.CONNECT, onSockCon); //Adds event that listens for connection to socket with serproxy

function onSockCon(e:Object):void {
  trace("Socket Connected");
  arduino.addEventListener(ArduinoEvent.FIRMWARE_VERSION, onReceiveFW); //Adds event that listens for firmware to be returned
  arduino.requestFirmwareVersion(); //Requests Firmware

function onReceiveFW(e:ArduinoEvent):void {
  trace("Firmware Received)";
  arduino.setPinMode(6, Arduino.INPUT); //Sets pin 6 to INPUT
  arduino.enableDigitalPinReporting(); //Knows to listen for digital input
  arduino.addEventListener(ArduinoEvent.DIGITAL_DATA, onReceiveD); //Adds event that listens for digital data to be returned

function onReceiveD(e:ArduinoEvent):void {
  trace("Data Received!");


The output consists of just:
Socket Connected
Firmware Received

and when I change the input on pin six (by connecting it to power or ground) nothing happens. What am I doing wrong?


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131