VLL Transmit for legOS

Doug Eaton posted a message to lugnet.robotics with a pointer to the details of the VLL protocol which he reverse-engineered.

As a legOS programming exercise I wrote a small library to transmit VLL codes using the LED in the LEGO light sensor. You can download the source which includes a diff to kernel/dsensor.c required to enable the sensor access that vll.c needs. You can add VLL to the kernel if you like, or just compile it into your own applications.

The distribution includes a legOS.srec and legOS.lds which includes the required patch as well as VLL built in. To use it:

#include <dsensor.h>
#include "vll.h"

yourfunc()
{
	/* take over light sensor on input 1 */
        vll_init(&SENSOR_1);
        vll_send(VLL_MS_FWD);
	...
	vll_stop();
}

Features

Limitations

There are a few aspects which could work better:

Future Work

Okay, I admit, I'll probably never use this for anything. On the other hand, if you are big into MicroScout programming, or you have a Code Pilot, it might be useful to have an RCX app that lets you build small programs on the console of the RCX.

Disclaimer

If this fries your light sensor, I take no responsibility! You are trying this at your own risk.

Other VLL Implementations

About a day after I announced this code for legOS, Jin Sato announced a VLL library for NQC written by Shigeru Makino. They have code to use the light sensor as an output device and also support using a LEGO lamp connected to a motor output. Due to the limitations of NQC their transmit rate appears to be about one third that of the legOS version.
[Ben Jackson's Home] [LEGO Raytracing Home] [Mindstorm]