Facebook Pixel Learn Lisp Programming Using MCUs - Part 2: Extending µLisp with Custom Functions | Circuit Cellar - education - Lee esta historia en Magzter.com

Intentar ORO - Gratis

Learn Lisp Programming Using MCUs - Part 2: Extending µLisp with Custom Functions

Circuit Cellar

|

February 2025

In the second installment of this series, Raul delves into the world of µLisp and shows how to extend capabilities by adding custom functions such as "pulsein" and "servo-create", enabling developers to interface with ultrasonic sensors and control servomotors. In Part 1, Raul presented µLisp concepts and syntax, and extensions specific to MCUs.

- Raul Alvarez-Torrico

Learn Lisp Programming Using MCUs - Part 2: Extending µLisp with Custom Functions

μLisp is a dialect of the Lisp programming language. It is tailored to microcontrollers having limited amounts of RAM, and can be run on various platforms—from the Arduino Uno based on the ATmega328, up to the Teensy 4.0/4.1 [1]. To follow the topics discussed here, you need to be acquainted with the Arduino platform and any programming language from the Lisp family. Please see Part 1 of this article series (“Crash Course Offers Insight into Pioneering Language,” Circuit Cellar 411, October, 2024) for a brief introduction to Lisp programming and the µLisp dialect [2].

With µLisp, it is possible to add your own extension functions, such that they appear as built into the language after re-compiling and flashing the µLisp interpreter to your Arduino board. There’s an excellent tutorial on how to do this on the µLisp website [3]. I will build on that tutorial to discuss how to add custom functions. For the examples presented here, I will continue to use Seeed Studio’s Wio Terminal MCU development board; but the information discussed also can be applied to other µLisp-supported Arduino boards.

EXTENDING µLISP

In general, any function not supported by default in µLisp can possibly be added as an extension to the language—for instance, hardware access functions for servomotor control. Let’s explore a simple example to help us understand how the language extension system works.

Listing 1 shows the Arduino C code for adding the pulsein extension to µLisp, which is not available by default. This extension will make it possible to measure digital pulse widths. Five sections of the listing show the µLisp extensions structure. Like the core µLisp interpreter, extensions are also written in Arduino C language. So, any extensions to the interpreter imply basically writing C code. That makes adding them straightforward, using the Arduino C language built-in functions and external libraries.

MÁS HISTORIAS DE Circuit Cellar

Circuit Cellar

Circuit Cellar

Inside the Tech: E-Bikes Explained

The Future of Product Developement Nature

time to read

5 mins

March 2026

Circuit Cellar

Circuit Cellar

Mesh for Embedded Control

Mesh Networks Are Rewiring Embedded Systems

time to read

11 mins

March 2026

Circuit Cellar

Circuit Cellar

A System That Detects, Tracks, and Deters Deer

Using Computer Vision, an Arduino, and a Raspberry Pi 5

time to read

14 mins

March 2026

Circuit Cellar

Circuit Cellar

Analog Meets Digital

Part 4: Eliminating Mains Interference with an ADC

time to read

19 mins

March 2026

Circuit Cellar

Circuit Cellar

Datasheet: Linux-Based SBCs

SBCs Running Linux Bring Enterprise Power to the Network's Edge

time to read

8 mins

March 2026

Circuit Cellar

Circuit Cellar

Running Model Trains Without Human Input

A Raspberry Pi Pico Controls Two Trains

time to read

9 mins

March 2026

Circuit Cellar

Circuit Cellar

Connector Requirements for High-Voltage Healthcare Applications

Simplifying Safety and Security

time to read

9 mins

March 2026

Circuit Cellar

Circuit Cellar

PIC32CM PL10 MCUs Expand Microchip's ARM Cortex-MO+ Portfolio

Building on decades of experience, Microchip Technology has added PIC32CM PL10 MCUs to its PIC32C family of ARM Cortex-M0+ core devices. PL10 MCUs feature a rich set of Core Independent Peripherals (CIPs), 5V operation, touch capabilities, integrated toolsets and safety compliance.

time to read

1 mins

March 2026

Circuit Cellar

Circuit Cellar

From Buffer Overflows to Control Flow Attacks

This article extends the January 2026 article by showing a buffer overflow attack that changes a return value. I also discuss the use of the GCC stack protection feature, and demonstrate that it's not always a bulletproof protection method, even if it is better than doing nothing.

time to read

7 mins

March 2026

Circuit Cellar

Circuit Cellar

Another Matter-Enabled MCU: the ESP32-C6

The list of MCUs that support the Matter protocol continues to get longer. In this column, Brian goes in-depth on one of the newer Matter-enabled MCUs and shows just how it compares to some of the alternatives now on the market.

time to read

21 mins

March 2026

Listen

Translate

Share

-
+

Change font size