Arduino Forum upgrade scheduled for Monday, October 20th, 11am-4pm (CEST). Sorry for the inconvenience!
Pages: [1]   Go Down
Author Topic: Read digital inputs via AS3Glue (flash)  (Read 533 times)
0 Members and 1 Guest are viewing this topic.
Wisconsin, USA
Offline Offline
Karma: 0
Posts: 27
Arduino Intrigued
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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;

//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?


Pages: [1]   Go Up
Arduino Forum upgrade scheduled for Monday, October 20th, 11am-4pm (CEST). Sorry for the inconvenience!
Jump to: