You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem: In Flash CS3 Professional, calls to writeByte() in Arduino.as only
fill an internal buffer and are not sent to SerialProxy over the TCP socket
right away.
What steps will reproduce the problem?
Here is a short example that toggles an LED based on mouse click/release on
the stage (written in Flash CS3 Professional, all code in Layer 1, Frame 1):
===
import net.eriksjodin.arduino.Arduino;
import net.eriksjodin.arduino.events.ArduinoEvent;
import flash.events.MouseEvent;
var arduino:Arduino = new Arduino("127.0.0.1", 5331);
function onMouseClickEvent(event:MouseEvent):void {
if(event.buttonDown) {
arduino.writeDigitalPin(2, Arduino.HIGH);
}else {
arduino.writeDigitalPin(2, Arduino.LOW);
}
}
arduino.setPinMode(2, Arduino.OUTPUT);
stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseClickEvent);
stage.addEventListener(MouseEvent.MOUSE_UP, onMouseClickEvent);
===
What is the expected output? What do you see instead?
Final expected output is LED connected to pin2 toggling on/off with mouse
clicks. Intermediate expected output is seeing appropriate bytes
tranmitted from SerialProxy to Arduino using a serial port snooper. This
does not happen. Bytes for setPinMode() are sent, (0xF4 0x02 0x01), but
subsequent writeDigitalPin() bytes are not sent.
What version of the product are you using? On what operating system?
latest Glue.zip download, FlashCS3 Professional on Windows Vista.
Solution:
According to Adobe's ActionScript3 documentation for the Socket class, an
explicit call to flush(); forces bytes in the transmit buffer to be
flushed. Calls to flush() should be inserted at the end of all functions
that send data to Arduino/SerialProxy.
Modified Arduino.as with flush statements is attached (also fixes
disableDigitalPinReporting() issue).
Original issue reported on code.google.com by bjoern.h...@gmail.com on 12 Feb 2008 at 7:10
Was anyone successful in getting this library working from Flex 2? I and some
other
developers had issues with that. See it here:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1199418749
Original comment by ravivarm...@gmail.com on 13 Feb 2008 at 8:05
Interesting, I never had any problems with this myself, but it could explain
some
strange issues that people have had.. Thanks for finding both the problem and
the
solution...
Original comment by erik.sjo...@gmail.com on 26 Feb 2008 at 2:20
Original issue reported on code.google.com by
bjoern.h...@gmail.com
on 12 Feb 2008 at 7:10Attachments:
The text was updated successfully, but these errors were encountered: