Hi,
I have several sensors connected to my Arduino, as well as a bluetooth LE chip. I'm trying to transmit sensor data via bluetooth into a Flash CS6 app running on my Windows 7 laptop. I've tried using a USB cable (disconnecting the bluetooth module on the board), and it works perfect using Tinkerproxy. But when I try using a usb bluetooth dongle (Blue Radios 4.0 Low Energy, which puts the data on the serial port), I can't get more than one data event in Flash. It's as if Flash sees serial data differently if it's coming from a cable vs. coming from the usb bluetooth.
When I use PUTTY , I am able to receive and see the continuous arduino data just fine via bluetooth (the usb dongle directs this data to the serial connection on com4 on my windows 7 laptop). But I cannot read this into Flash. I can connect in Flash, but the socketData handler (in AS3-Arduino-Connector) or onArduinoData handler (Tinkerproxy) only triggers once (and strangely, only after I had PUTTY running, must rerun PUTTY each time, and then run Flash again to get just one data event in Flash). From PUTTY , I do need to initially send the bluetooth dongle the commands "at", and then "atdmle,ecfe7e105654" which is to connect to my bluetooth device on the arduino. After that, the data comes through fine on PUTTY. So I thought I need to use the Ardunio send command from Flash to send these initial commands. Tried that but also doesn't work. Any ideas much appreciated. I've tried using this update to Tinkerproxy, which was meant to fix this bluetooth issue, but it doesn't change anything: http://lj9.mexinetica.com/bloginetica/comentarios.shtml?2011.04.12.10.09.22.+01
Here's some code using AS3-Arduino-Connector: The issue is that the fnc_dataArduino handler only runs one time, and only if I just ran PUTTY beforehand.
import flash.events.DataEvent;
import flash.display.MovieClip;
import com.quetwo.Arduino.ArduinoConnector;
import com.quetwo.Arduino.ArduinoConnectorEvent;
public class StartConnection extends MovieClip {
public var arduino:ArduinoConnector;
public function StartConnection(main:Main) {
arduino = new ArduinoConnector();
arduino.connect("COM4",115200);
arduino.addEventListener("socketData", fnc_dataArduino);
//If using TINKERPROXY arduino.addEventListener(DataEvent.DATA, onArduinoData );
//arduino.connect( "127.0.0.1", 5331 );
}
private function fnc_dataArduino(aEvt: ArduinoConnectorEvent): void{
trace("From Arduino: " + arduino.readBytesAsString());
}
}
Thanks!
Andre