Arduino Mega 2560
The Arduino Mega 2560 is based on the Atmel ATmega2560 processor running at 16 MHz, which provides 256 Kbytes of program memory, 8 Kbytes of RAM, and 4 Kbytes of EEPROM. I've tested uLisp with an official Arduino Mega 2560 board:
Also with a Chinese equivalent [1]:
LEDs
The Arduino Mega 2560 has an orange LED connected to the digital pin 13 which you can flash with the following program:
(defun blink (&optional x) (pinmode 13 :output) (digitalwrite 13 x) (delay 1000) (blink (not x)))
Run it by typing:
(blink)
On the Arduino Mega 2560 pin 13 can also be used as an analogue pin, so you can pulsate the orange LED slowly on and off with the program:
(defun pulse () (let (down) (loop (dotimes (x 256) (delay 5) (analogwrite 13 (if down (- 255 x) x))) (setq down (not down)))))
Run it by typing:
(pulse)
Exit from either program by entering ~.
Crius All in One Pro
Another interesting Arduino-compatible ATmega2560-based board is the Crius All In One Pro, intended for use as a multicopter controller. It's an ideal platform for running uLisp, and could form the basis for uLisp robot and control projects:
It fits on a board just 2" (5cm) square, and is available from many sites at about £25 or $35. I bought mine from Aliexpress [2], but it is also available on Banggood [3] and eBay.
The board includes USB, I2C, SPI, and serial interfaces, all of which are brought to connectors at the edge of the board. Most suppliers include a set of cables to allow you to connect to each interface.
It is supplied with a bootloader already installed, and you can program it via the USB port by setting the Board option to Arduino/Genuino Mega or Mega 2560 in the Arduino IDE.
The board includes several interesting sensors, including an MPU-6050 accelerometer and gyro, a HMC5883L 3-axis digital magnetometer, a MS5611-01BA01 high precision altimeter, and an SPI serial memory which could be used for data logging.
LEDs
The Crius board has red, blue, and green LEDs labelled A, B, and C connected to the digital pins 13 , 31, and 30 respectively which you can flash in sequence with the following program:
(defun blink () (let ((x 0) (pins '(13 31 30))) (mapc pinmode pins '(:output :output :output)) (loop (digitalwrite (nth x pins) :low) (setq x (mod (1+ x) 3)) (digitalwrite (nth x pins) :high) (delay 1000))))
Run it by typing:
(blink)
- ^ Mega 2560 R3 on Banggood.
- ^ Crius All In One Pro v2.0 AIOP RC Multi-Copter Flight Control Board on Aliexpress.
- ^ Crius All In One Pro v2.0 Multi-Copter Flight Control Board on Banggood.