Go Down

Topic: Urgent - analog pin as digital input with flash (Read 414 times) previous topic - next topic


Hi all,

I want to use analog analog pin as digital input pin in as3 as i ran out of digital pins.

I can use it in arduino IDE by writing,


pinMode(14, INPUT);
digitalRead(14, HIGH);

but how can i use it in as3? It is not working with flash. I used the following code in as3,


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

var a:Arduino;
a = new Arduino("", 5331);
a.addEventListener(Event.CONNECT , onSocketConnect);
a.addEventListener(ArduinoEvent.FIRMWARE_VERSION , onReceiveFirmwareVersion);
a.addEventListener(ArduinoEvent.DIGITAL_DATA, onReceiveDigitalData);

function onSocketConnect(e:Event):void

function onReceiveFirmwareVersion(e:ArduinoEvent):void


function onReceiveDigitalData(e:ArduinoEvent):void
trace(e.pin , e.value);


As you can see in the code I am also using digital pin 2 and it works with the digital pin 2 but its not working with digital pin 14.

I  want to analog pin 0 (digital 14) to detect motion form a digital PIR sensor (high and low) without expander. I think I am missing something in flash code.

Waiting for your quick replies. I am in real urgent at this moment.

Thank you all in advance.

Cheers !!



Code: [Select]
digitalRead(14, HIGH);

I have no idea what the outcome of that piece of code will be, but you certainly can't read something "HIGH".  You can either write it high, or read it.


"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

Go Up