Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible to work with more than one ArduinoConnector / Arduinos in one application #19

Open
GoogleCodeExporter opened this issue Mar 30, 2015 · 6 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Create two ArduinoConnector instances in one AIR application
2. Connect to both devices on different COM Ports
3. Get Data just from one

What is the expected output? What do you see instead?
Expected output would be serial data from both input devices, instead I just 
get data from one inside my Air application.

What version of the product are you using? On what operating system?
Arduino Connector 1.2.0 with Flash Professional CS6 on Win 7 64bit

Please provide any additional information below.

I made a short code sample what I'd like to achieve, is this possible with 
ArduinoConnector? And if so, what should I change to get it working?

//

package  {

    import flash.display.MovieClip;

    import com.quetwo.Arduino.ArduinoConnector;
    import com.quetwo.Arduino.ArduinoConnectorEvent;    

    public class Main extends MovieClip {

        public var scannerConnector: ArduinoConnector = new ArduinoConnector();
        public var arduinoConnector: ArduinoConnector = new ArduinoConnector();

        public function Main() {
            fnc_setupScannerConnector();
        }

        // function to setup the scannerConnector
        public function fnc_setupScannerConnector(): void{
            trace("Hi from setupScannerConnector");
            scannerConnector.connect("COM13", 57600);
            scannerConnector.addEventListener("socketData", fnc_recievingData);
            arduinoConnector.connect("COM10", 57600);
            arduinoConnector.addEventListener("socketData", fnc_dataArduino)
        }

        private function fnc_dataArduino(aEvt: ArduinoConnectorEvent): void{
            trace("From Arduino: " + arduinoConnector.readBytesAsString());
        }
        // function that gets called after data has been sent over the socketStream
        private function fnc_recievingData(aEvt: ArduinoConnectorEvent): void{
            // read out the data and put it into a temporary String
            var tempArray: Array = scannerConnector.readBytesAsArray();

            // extract the URL values from inside the bytesArray
            var i: int;
            for(i = 0; i < tempArray.length; i++){
                // look for starting character
                if(tempArray[i] == "#"){
                    var urlString: String;
                    // write the array entries into a string
                    for(i = i+1; i < tempArray.length; i++){
                        urlString = urlString + tempArray[i];
                    }
                    // remove the null character
                    urlString = urlString.slice(4, urlString.length);
                    trace("Extracted URL: " + urlString);
                    break;
                }
            }
        }
    }
}


// Thanks for your time and this awesome ANE

Original issue reported on code.google.com by [email protected] on 31 Jan 2013 at 3:44

@GoogleCodeExporter
Copy link
Author

Will add this support in 2.0

Original comment by [email protected] on 23 Apr 2013 at 3:29

  • Changed state: Accepted
  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Hi Nicholas,

THANK YOU! This will be a real fine thing...not to hassle with Native 
Applications and serproxy.

Thanks for this great project!

Original comment by [email protected] on 23 Apr 2013 at 7:08

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Hi Nicholas,

Is it possible to establish two independent connections (on two COM ports) as 
above now in latest update? Thanks!

Andre

Original comment by [email protected] on 29 Jun 2013 at 12:32

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Really nice extension, it saved me so much time. I'm also wondering if you can 
use multiple Arduino boards with this.

Original comment by [email protected] on 21 Nov 2013 at 4:49

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

Hello Nicholas, first of thank you for this great ANE, its a much better 
solution than having to deal with serproxy, zinc and a bunch of others. Just 
wanted to check if there are any updates about the multi comport support.

regards
Daniel

Original comment by [email protected] on 14 Aug 2014 at 8:18

  • Added labels: ****
  • Removed labels: ****

@GoogleCodeExporter
Copy link
Author

You have to use the "FREContext ctx" in C native app for working with multiple 
instances.

Original comment by [email protected] on 21 Aug 2014 at 3:47

  • Added labels: ****
  • Removed labels: ****

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant