Interactive embedded development with uLisp, Arduino and Emacs

As I mentioned in my post about Ada Lisp has a completely different approach in terms of… well, just about everything, beginning with the type system. One important feature of Lisp environments is the high degree if interaction they provide: Lisp Systems allowed for interaction with every part of the system (OS, applications, window manager…) and to a smaller degree this is what the read-eval-print-loop approach (REPL) provides in, say, Emacs with SLIME.

One interesting language I found recently was uLisp, a Lisp language for the Arduino and MSP430 platforms. It is based on a subset of Common Lisp and provides a different approach to development: it installs an interpreter which is programmed via the serial interface, thus allowing for a much more interactive development style (at a certain cost in terms of available space).

The interaction is normally made with the Arduino IDE, via the Serial Monitor; uLisp contains a minimal editor as well, but using Emacs makes more sense and it’s actually easy to configure to that end; before going into the details this is the end result (zoom in the image if necessary to start the animation).

The main thing to consider is that inferior-lisp-mode is actually based on comint-mode, which simplifies things: we just need a way to replace the buffer created by calling inferior-lisp with a buffer that communicates via the serial port. This is, in turn, something which can be done using Emacs term-mode.

Combining all of this the following Emacs Lisp code will connect to the Arduino via the serial port, rename the resulting buffer and change to line mode.

Creating a new Lisp file (like test.lisp) will by default enter lisp-mode; in this mode we can use C-x C-e to send the s-expression to the uLisp interpreter and get the result, as seen in the previous screencast

I’ve put the Lisp code on Github as well.

On the Ada language and embedded development

I’ve been recently drawn to Ada (once again). Now, I’m a Lisper through and through and in a way Ada is the exact opposite of Lisp, especially in terms of typing, but perhaps because of that I find it quite interesting. Showing the end result right now, here is the canonical blinking LED done in […]

Skin lesions classification: SparkR in DSX with IBM Watson visual recognition (9th WBME)

I have recently had the pleasure of paricipaing in the 9th Workshop on Biomedical Engineering that occurred in the Faculty of Sciences of the University of Lisbon; it is always refreshing to attend such events since one is exposed to a lot of extremely interesting research that is easy to miss when focusing on the […]

Using MQTT in Common Lisp with ABCL and the Eclipse Paho client

I have recently written some posts about using Clojure to take advantage of Java libraries. The idea of using a Lisp language that can take advantage of existing Java infrastructure is something that can however be achieved in different ways, Clojure being but one of them. On the Scheme side I know at least GNU […]

Publishing messages with MQTT, using Clojure and the Eclipse Paho client

As alluded in my last post I have found that MQTT (MQ Telemetry Protocol) is quite simple to use, and especially so when compared to most other messaging protocols. In particular it’s a great fit for embedded devices or whenever resources are limited, since it’s quite lightweight. From the MQTT page:   MQTT is a machine-to-machine (M2M)/”Internet […]