The latest release 4.7c incorporates the following improvements:
Copying the last line
Press the Tab key to echo the previous line typed after the uLisp prompt, allowing you to edit it.
Connecting to a computer
If you prefer to use the Serial Monitor by connecting the Raspberry Pi Pico micro USB port to the computer, compile and upload uLisp after commenting out this line as shown:
// #define Serial Serial1
Sound
You can now play notes through the internal speakers using the uLisp note function. For example, the following function plays a scale of C (the pin number is ignored):
(defun scale ()
(mapc
(lambda (n) (note 0 n 4) (delay 500))
'(0 2 4 5 7 9 11 12))
(note))
The beep character beeps the speaker:
(write-byte 7)
Reading a pixel
The function read-pixel reads a pixel from the screen at coordinates (x,y):
(read-pixel x y)
It returns the 5-6-5 colour value.
For example, the following kaleidoscope function takes a triangular section of the image on the screen, and reflects it through horizontal, vertical, and diagonal lines to create a symmetrical image, like a kaleidoscope:
(defun kaleidoscope ()
(let ((xsize 320)
(ysize 320))
(dotimes (x (/ ysize 2))
(dotimes (y (1+ x))
(let ((colour (read-pixel x y)))
(do ((i x (- ysize x 1)) (m 0 (1+ m)))
((>= m 2))
(do ((j y (- ysize y 1)) (n 0 (1+ n)))
((>= n 2))
(draw-pixel i j colour)
(draw-pixel j i colour))))))))
Here’s the result of running it on a listing of itself, and then saving the screen as a BMP file using save-bmp:
Saving an image of the screen
The function save-bmp saves a copy of the screen as a BMP format image file to the SD card with the specified filename:
(save-bmp filename)