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.
μ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.
Esta historia es de la edición February 2025 de Circuit Cellar.
Suscríbete a Magzter GOLD para acceder a miles de historias premium seleccionadas y a más de 9000 revistas y periódicos.
¿Ya eres suscriptor? Iniciar sesión
MÁS HISTORIAS DE Circuit Cellar
Circuit Cellar
Saelig Introduces Economical AIM-TTI ATG1005 5MHz Function Generator
Saelig Co., Inc. announces the AIM-TTI ATG1005 Touchscreen Function Generator, which uses advanced Direct Digital Synthesis (DDS) technology to deliver high-quality, low-distortion Sine, Square, and Pulse waveforms to 5MHz, and triangle waveforms to 500kHz.
1 mins
January 2026
Circuit Cellar
The Future of Edge AI Ultra-Low Power Edge AI
The Case for Intelligence at the Source
3 mins
January 2026
Circuit Cellar
IR Images Come to Your Cellphone
In this article Brian uses a Melexis MLX90640 IR camera module coupled to an ESP32 controller. He streams the image data to a web browser running on a cell phone, tablet, or computer, eliminating the need for a dedicated color LCD. Together, this makes for a very low-price IR camera.
20 mins
January 2026
Circuit Cellar
STMicroelectronics' Intelligent Power Switch Automatically Adjusts to Handle Inrush Current
STMicroelectronics' IPS1050LQ low-side switch IC provides flexible overcurrent protection, including a static mode with fixed, programmable current limit and a dynamic mode that safely handles high inrush current.
1 min
January 2026
Circuit Cellar
Nordic Semiconductor Unveils nRF54LV10A - Breakthrough Low-Voltage Bluetooth LE SOC for Next-Gen Healthcare Wearables
Nordic Semiconductor, a global leader in low-power wireless connectivity solutions, launches the nRF54LV10A SoC, setting a new benchmark for integration, performance, and battery life in the smallest medical devices.
2 mins
January 2026
Circuit Cellar
SemiQ Expands 1200V Gen3 SiC MOSFET Line with Launch of 7.4, 14.5, and 34m2 SOT-227 Modules
SemiQ Inc, a designer, developer, and global supplier of superior silicon carbide (SiC) solutions for ultra-efficient, high- performance, and high-voltage applications, has expanded its family of 1200V Gen3 SiC MOSFETs, launching five SOT- 227 modules that offer RDSon values of 7.4, 14.5, and 34mΩ.
1 min
January 2026
Circuit Cellar
Datasheet: Power Quality Monitoring Watching the Peaks and Valleys
Systems for Monitoring Power Quality for Homes and Industry
2 mins
January 2026
Circuit Cellar
Build a Miniature Greenhouse for Hydroponic and Potted Plants
Automated Monitoring with a Raspberry Pi 4B
10 mins
January 2026
Circuit Cellar
The Pulse of Innovation 600
The Rise of Wearable Technology
18 mins
January 2026
Circuit Cellar
Build a Smart Energy Meter to Track Home Power Use
Using an ESP32 Dev Kit and PZEM-004T Energy Sensor Module
12 mins
January 2026
Listen
Translate
Change font size

