The new sleep function in uLisp 2.1


#1

The new sleep function in uLisp 2.1 opens up the possibility of using uLisp in battery-powered applications, such as in data acquisition.

The following program tests the current consumption while sleep is running:

(defun low ()
  (let* ((pin 32)
         (fla (lambda () 
                (digitalwrite pin t)
                (delay 100)
                (digitalwrite pin nil)
                (delay 100))))
    (pinmode pin t)
    (loop
     (fla)
     (delay 10000)
     (fla) (fla)
     (sleep 10))))

It runs for 10 seconds using delay, flashes the LED twice, and then puts the processor to sleep for 10 seconds using sleep.

Using an ATmega1284P running uLisp on a prototyping board the current consumption drops from 22mA at 5V using delay, to 70µA using sleep: