User Tools

Site Tools


wio:wio-ledscript-en

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.
o<report> Report end of script in case set to 1. (Default 1, set to 0 for disable reporting.)


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 with the given max. value
G<green> RGB green randomised with the given max. value
B<blue> RGB blue randomised with the given max. value
I<brightness> LED brightness randomised with the given max. value
P<pause> Randomised pause in units of 10ms with the given max. value
a Randomise this definition, RGB, brightness and pause values with the given max. values

The rgbip 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 d address

LED OFF

At a LED(output) off command, the following fields are used to reset LEDs:

D<nr> Starting LED address
T<count> Number of LEDs starting from D address


e End of the LEDScript.


Upload

ledscript-upload-en.jpg 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:

i80 // 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.txt · Last modified: 2020/11/03 08:23 by rjversluis