Skip to content

Latest commit

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Lua Example on Teensy 3.6

This is Lua 5.1.5 with the following patches:

  1. Lua Tiny RAM (LTR)

    This is used in eLua and nodemcu

  2. Lua Compact Debug (LCD)

    Original patch can be found here: https://github.com/TerryE/lua-5.1/commits/master

  3. Changes to support printing to Serial and file loading from SdFat.

Running

Compile in the Arduino IDE or change ARDUINO_DIR in lua-teensy/Makefile to point to where the arduino ide is installed on your linux system.

make && make upload
sleep 2;
miniterm.py /dev/ttyACM0 115200

Example output

--- Miniterm on /dev/ttyACM0 115200,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
SD Card Init ...
SD Card Init Complete
=== Help =========================
SD Card functions:
sd.ls()
sd.cat("ram.lua")
sd.run()
RAM Usage:
print(collectgarbage'count')
Force garbage collection:
collectgarbage'collect'
Use EOT (Ctrl-D in miniterm.py) to exec code
>> print(math.sqrt(2))␄
1.4142135381699
>> print(collectgarbage'count')␄
5.8896484375
>>

Helpful Lua C API Links

About

Example of embedding Lua on the Teensy 3.6

Resources

Stars

12 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages