User Tools

Site Tools


wio:wio-ledscript-en

This is an old revision of the document!


LEDScript

Introduction

LEDScript runs in WIO context, and can be activated by Rocrail commands.
Its a simple plain ASCII file, which must be uploaded to the WIO.
The target Color LEDs must be supported by the FastLED library.


Requirements

WIO version 295+.
Rocrail version 2.1.1042+.


Format

The text format has some restrictions:

  • A blank line will stop the LEDScript parser the same as with 'end'.
  • Comment lines are prefixed with the '#' sign, and are restricted to 64 characters incl. linefeed.
  • Only linefeeds are allowed without extra carriage return. (Unix format)


File naming

The filename must be formatted like this:

<freetext><nr>.led

The number, <nr> ranges from 01 to 99.
Example:

disco04.led

Zero, *00.led, cannot be addressed.


Instructions

The header just contains one line:

s<iterations>

The max. number iterations is 255, and zero will cause an endless loop.


LED Definition

l<nr> Starting LED address, and triggers a new record
c<count> Number of LEDs starting from l address
r<red> RGB red value
g<green> RGB green value
b<blue> RGB blue value
i<brightness> LED brightness
p<pause> Pause in units of 10ms
R<red> RGB red randomised value
G<green> RGB green randomised value
B<blue> RGB blue randomised value
I<brightness> LED brightness randomised value
P<pause> Randomised pause in units of 10ms
a Randomise the RGB, brightness and pause values with the given max. values

The rgbBp values can be left out, and in this case the last parsed values are used.


LED Reset

If t > 0 this is used at the end of the script to reset LEDs.

d<nr> Starting LED address
t<count> Number of LEDs starting from s address


The footer marks the end of the LEDScript:

e


Upload

Uploading LEDScript files can be done with a WEB Browser as explained here:
Upload by WEB Browser


Activating

Output

Set the address value greater then 100, and <nr> is address - 100.

Car Function

Set the LED address value greater then 100, and <nr> is address - 100.


Examples

# start 0=endless loop, 1...255=iterations
s2 
# led 0 to 5
l0
c6
r255
g0
b0
i50
p1000
# led 0 to 2
l0
c3
r255
g255
b0
i50
p1000
# end
e
# Disco
# start 0=endless loop, 1...255=iterations
s0 
# led 0 to 19
l0
c20
# random
a
r255
g100
b100
i80
p20
e


WIO LEDScript Parser

The WIO parser is very simple, and reads the file line by line.
After reading a line, the first character is checked as listed in the Instructions paragraph.
If a number is expected, the C function atoi() is used with the line pointer + 1. A none numeric character should follow the number.
Because of the simple nature of this parser, it is also allowed to add some text to make the LEDScript more readable:

B80 // brightness 80 of 255
p20 // pause 20 * 10ms
end

But the total line length, incl. linefeed, should not exceed the 64 byte boundary.

wio/wio-ledscript-en.1604126711.txt.gz · Last modified: 2020/10/31 07:45 by rjversluis