hxL8 is a Haxe based communication library for L8 smartlight
There are currently two tools based on that library:
- L8Ctl is a command line application for Windows, Mac OSX, Linux and Raspberry Pi that enables you to send commands to your L8 - also comes as Java version
- L8NodeSrv is a node.js server version of L8Ctl, with most of the commands the cli version offers, it enables you to talk to your L8 over a network using simple HTTP GET requests
The bin
folder contains binaries for all supported systems in zip/tgz format and unpacked.
You can also compile it from Haxe sources (by calling haxe build.hxml
see requirements)
- setting led matrix
- framegrab
- superled
- text scroller
- version and UID
- running firmware apps (color changer, dice, etc.)
- notifications
- L8y support
- frame support
- animation support
- read sensor data
- boxes
- ad-hoc animations
- server based using node.js
-
git
-
XCode on MacOSX
-
Visual Studio on Windows
-
gcc/g++ on Linux
-
JDK
-
haxe
install Haxe libraries
haxelib install hxcpp
haxelib git hxSerial https://github.com/AlexHaxe/hxSerial.git
haxelib install hxlode
haxelib install nodejs
haxelib install hxjava
haxe buildWin.hxml
output folder out32
haxe buildMac.hxml
output folders
- out32
- out
- outJava
- outNodeJS
haxe buildMac.hxml
output folders
- out32
- out
- outJava
- outNodeJS
Serial ports on Raspberry Pi might need some additional setup, to make communication reliable:
stty -F /dev/ttyACM0 -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke min 1 time 0 -brkint -icrnl -imaxbel -opost -onlcr
(maybe not all options are needed, but they work for me)
You need to call stty before running L8Ctl!
- you need a working node.js installation
- download bin/L8/NodeJS/L8NodeSrv.js to a new folder
- run
npm install serialport
in that folder - launch with
node L8NodeSrv.js
- point your browser to http://localhost:1818/
You can add two parameters to the start command, a port and the default serial device:
node L8NodeSrv.js 8888 /dev/rfcomm0
L8NodeSrv.js has a simple Homepage that contains a few examples with direct links. You can call any command by just putting it in the address bar of your browser.
L8NodeSrv.js accepts GET requests and works similar to the command line version, only you have to use a /
instead of a space to set your parameters.
You can also send the interface with every GET request, so if you have multiple L8s you can specify which one to use.
You cann have multiple commands in one GET request, as long as you put in the required parameters (same as cli version).
Not everything is working perfectly, if you specify the wrong serial device node.js might crash.
L8Ctl <command> [<parameter(s)>]
Commands (case insensitive):
appstop
-> stop current appappambient RGB RGB threshold
-> start ambient light app with matrix color, superled color and thresholdappcolorchange Multicolor|Tropical|Galaxy|Aurora speed true|false
-> Start color changer app with speed in SuperLED invert(= true), default: falseappdice RGB|RRGGBB
-> Start dice app with optional color, default: F00appproximity RGB RGB threshold
-> start proximity app with matrix color, superled color and thresholdparty
-> run party app
AutoRotate true|false
-> enable / disable autorotateBatChg
-> battery charge statusButton
-> read button statusGetAcc
-> get values of accelerometerGetAmb
-> get values of ambient sensorGetMCUTemp
-> get current MCU temperatureGetMic
-> get current noise sensor valueGetProx
-> get value of proximity sensorGetTemp
-> get value of temperature sensorGetThreshold
-> get current ambient, noise and proximity thresholdsGetVoltage
-> get the voltage of L8 batteryGetVBUS
-> get the voltage of USB connectionSetOrientation top|bottom|left|right
-> sets orientationSetAmbThreshold min max
-> sets min max values of ambient thresholdSetNoiseThreshold min max
-> sets min max values of noise thresholdSetProxThreshold min max
-> sets min max values of proximity threshold
CSV
-> print responses in CSV formatCSVHeader
-> print responses in CSV format with headerHex
-> print responses in raw hex format
DeleteL8y l8y#
-> Delete L8y by number (between 0 and GetNumL8ies)GetNumL8ies
-> get the number of L8ies in User spaceL8y l8y#
-> show L8y (between 0 and GetNumL8ies)ReadL8y l8y#
-> get matrix colors for L8y (l8y# between 0 and GetNumL8ies)StoreL8y 64*(RGB|RRGGBB)
-> stores a L8y (returns new index of L8y)StoreL8yFile Filename.png offsetX offsetY
-> stores a L8y from PNG file at offsetX/offsetY (returns new index of L8y) -> not in Java or NodeJS version
EnableAllNotifications true|false
-> enable/disable all notifications, default: trueEnableNotification notification# true|false
-> enable/disable notification, default: trueGetNotifyApp app#
-> get Name, Matrix colors, Super LED color and Enabled flag of app number (0-255)GetNumNotifyApps
-> get the number of notification appsNotify "Phone Call"|WhatsApp|Facebook|GMail|MobileMail|Tweet|SMS|Line|Instagram|Hangout|GooglePlus|Custom on|mod|off category#
-> display notification, parameters see belowStoreNotification appbundle 64*(RGB|RRGGBB) RGB true|false
-> creates a new notification for app-bundlename with color-matrix and SuperLED color and initial enabled status
DeleteFrame frame#
-> Delete Frame by number (between 0 and GetNumFrames)GetNumFrames
-> get the number of Frames in User spaceReadFrame frame#
-> gets frame from User Space (frame# between 0 and GetNumFrames)StoreFrame 64*(RGB|RRGGBB)
-> stores a new frame in userspace (returns new index of frame)StoreFrameFile Filename.png offsetX offsetY
-> stores a new frame in userspace from PNG file at offsetX/offsetY (returns new index of frame) -> not in Java or NodeJS version
DeleteAnim anim#
-> Delete Animation by number (between 0 and GetNumAnims)GetNumAnims
-> get the number of anims in User spacePlayAnim anim# true|false
-> plays animation # as loop = true or once = false; default: loop=trueReadAnim anim#
-> gets frame and duration for animation from User Space (anim# between 0 and GetNumAnims)StopAnim
-> stops current animationStoreAnim frame#,duration,frame#,duration,...
-> stores a new animation in userspace (returns new index of anim)
Brightness true|false
-> set low brightness of LEDs (matrix and super) true = high, false = low, default: falseBox left top right bottom RGB RGB RGB
-> shows a box from left/top to right/bottom with border, fill and outside colorGetMatrix
-> get current Matrix LEDMatrixLEDFile Filename.png offsetX offsetY
-> set matrix to 8x8 pixel area of Filename.png at offsetX/offsetY, default offset: 0/0 - only PNG supported! -> not in Java or NodeJS versionMatrixLEDUni RGB|RRGGBB
-> set matrix to one color, default: 000 = offMatrixLEDString 64*(RGB|RRGGBB)
-> set matrix to colorlistMatrixOff
-> clear matrixLed x y RGB|RRGGBB
-> set a single LED pixel
SuperLED RGB|RRGGBB
-> set superled to color, default: 000 = off
DisplayChar char top|bottom|left|right offset
-> displays char with offset in pixels from top|bottom|left|rightText RGB|RRGGBB text 0|1|2 true|false
-> scrolling text (max length: 18, color and text are required parameter) with speed 0 = fast, 1 = medium, 2 = slow and true|false for loop, Default: loop = true
Repeat #|forever delay
-> repeats all commands number of times specified or forever with optional delay (specified in 100th of a second) between commandsRepeatSilent #|forever delay
-> repeats all commands number of times specified or forever with optional delay (specified in 100th of a second) between commands without printing responses from L8
Interface devicename
-> sets COM-port to use, default: /dev/ttyACM0
Bootloader
-> switch to DFU modedelay ms
-> delay in ms between commands when sending multiple commands - Default: 100DeleteUserSpace
-> Delete userspaceInit
-> get trace infoPoweroff
-> poweroffReset
-> resetStatusLED true|false
-> turn status LEDs on or off, default: false = offUID
-> query device UIDVersion
-> query device versions
RGB|RRGGBB
- values in hex, either 3 or 6 digits, LEDs only support 4-bits per channel
64*(RGB|RRGGBB)
- values in hex should be: RGBRGBRGB... (= 192 chars) or RRGGBBRRGGBBRRGGBB... (= 384 chars)
Notifications
"Phone Call"|WhatsApp|Facebook|GMail|MobileMail|Tweet|SMS|Line|Instagram|Hangout|GooglePlus|Custom
- name of notifcation to display, Custom = use your own notificationon|mod|off
- allows to activate / show, modify and deactivate / remove a notification (only Incoming Call can be turned off)category#
- notification category number (0 = Other|1 = Incoming Call|2 = MIssed Call|3 = Voice Mail|4 = Social|5 = Schedule|6 = E-Mail|7 = News|8 = Health/Fitness|9 = Business/Finance|10 = Location|11 = Entertainment|255 = Unknown)
default interface: /dev/ttyACM0
(for Linux Bluetooth /dev/rfcomm0
)
(for Mac it is something like /dev/tty.usbmodem641
for USB and /dev/tty.L8-SerialPortServerPort1
for Bluetooth)
(for Windows use COM3
, COM4
etc. )
(on Windows using COM3 = default)
L8Ctl.exe super f00
sets super led to red
L8Ctl.exe super fff matrixuni f00
sets super led to white and matrix to all red
L8Ctl.exe matrixfile icon.png 50 50
sets matrix to contents of icon.png at offset 50×50
L8Ctl.exe text 00f “this is a test” 1 true
starts text scroller in blue with medium speed (= 1) and loop = true
L8Ctl.exe dice fff
starts dice app in white
L8Ctl.exe appstop
stops current app
L8Ctl.exe interface COM3 storeframe f00f70ff00f000f40880f storeframe f70ff00f000f40880ff00 storeframe ff00f000f40880ff00f70 storeframe 0f000f40880ff00f70ff0 storeframe 00f40880ff00f70ff00f0 storeframe 40880ff00f70ff00f000f storeframe 80ff00f70ff00f000f408
returns the frame numbers
L8Ctl.exe interface COM3 storeanim 15,1,16,1,17,1,18,1,19,1,20,1,21,1
replace 15-21 with frame numbers from previous command
L8Ctl.exe interface COM3 playanim 11
replace 11 with number returned from storeanim
Use at your own risk!
Windows32 binary was tested on Windows XP. Java binary was tested on Linux.
L8Ctl works with USB and Bluetooth (for Bluetooth to work you need to pair L8 with your computer first). L8NodeSrv was tested on Linux.