Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
hxSerial is a library for serial port communication in Haxe (C++/Neko target).
branch: master

Merge pull request #3 from AlexHaxe/master

Haxe 3.x compatibility patch
latest commit 6bc3db7032
Andy Li authored
Failed to load latest commit information.
hxSerial Haxe 3.x compatibility
ndll new Linux binaries
.gitignore first commit
README.textile reverted README changes
Test.hx cleaned imports
compile.hxml revert changes to compile.hxml
haxelib.xml cleanup



hxSerial is a library for serial communication in haXe (C++/Neko target). It is based on ofSerial in OpenFrameworks.

Download and Install

The most easy and proper way is from haxelib:

haxelib install hxSerial

Or you can download/checkout the source from the github repo.

How to use

Create a Serial object, given its device name and speed(in bits per second, ie.baud):

var serialObj = new hxSerial.Serial("/dev/tty.usbserial-A4001tkb",9600);

The device name above is something you will get in Mac. For Windows, it should be something like “COM7”. For Linux(Ubuntu), it should be similar to “/dev/ttyUSB0”.

You can check the device names by trace(hxSerial.Serial.getDeviceList()).

You can then read/write to the device using the readByte(s)/writeByte(s) method.

Note that you must read from the serial after setup. If the serial input is accumulated for too long, it will slow down the whole system.


For writing, writeByte() returns true if the operation is successful. writeBytes() returns the number of bytes it writes.


For reading, you first check the number of bytes arrived by calling available(). If the amount of bytes you needed is enough, call readByte() to get a single byte as Int or call readBytes() to get multiple bytes as String.

change log

version 0.1.1

Fixed memory leak and added Neko support.

version 0.1.0

First release. Supports Windows/Mac/Linux.

Something went wrong with that request. Please try again.