简体   繁体   中英

Wrapping Lua code in Python on Raspberry Pi

I am using Raspberry Pi model 3 and run my scripts on Raspbian Jessie.

I am trying to benchmark how much Lua is faster than Python. For this I wrote an in-place quicksort in both Lua and Python and printed execution times. Now, I want to show this physically by turning on a LED while quicksort is executing. I have no problem with Python code, I use simple Python RPi.GPIO module. But apparently the Lua RPi.GPIO module is outdated (not confirmed, it just gives me "This module can only run on Raspberry Pi" error which makes no sense) .

So now I am trying to wrap my Lua code in Python/C/Bash so that this wrapper script turns on LED while the quicksort executes in Lua. Is there any way to do that? I know nothing about shells or passing scripts as arguments, so any help is appreciated.

Maybe execute a python script that turns on the LED from Lua?

Something like,

os.execute("python turn_on_led.py")

This could be a performance issue, though.

我不知道它是否将基于RPi构建,但是Lunatic Python将允许您将Lua VM嵌入Python中,这意味着您可以让Python调用Lua代码并控制硬件。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM