lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello

I have played a little bit with my RPi once but i used C library using FFI (because i couldn't find decent Lua library, iirc)

local alien = require 'alien'
local pigpio = alien.load 'pigpio'

and then like:

local gpioRead = pigpio.gpioRead
gpioRead:types{"uint", ret ="int"}
-- ....
-- skip
-- ....
local function piSclkTick()
  gpioWrite(SCLK, HIGH)
  gpioDelay(SPI_SCLK_HIGH_TIME)
  local read_bit = gpioRead(MOSI)
  gpioWrite(SCLK, LOW)
  gpioDelay(SPI_SCLK_LOW_TIME)
  return read_bit
end

etc etc
just read about how to usa FFI with Lua, and docs on pigpio library

Sincerely,
  Volodymyr



On Sun, Dec 20, 2020 at 4:57 PM Foster Schucker <Foster@schucker.org> wrote:
Because we are a much extended family, our Christmas comes early,
normally the week before.

One of my gifts this year was a huge selection of Breakout Garden kits
from Pimorni

https://shop.pimoroni.com/collections/breakout-garden

I'd like to connect them to my Pi (the easy part) and then mess around
with Lua making things happen (the fun part)

But there is a fair amount of bit banging to get the I2C and SPI devices
to work.

Can you suggest a library that works with the Raspberry PI that you have
used?

One of my goals is to incorporate devices like the RGB encoder or the
trackball into my Pico-8 or Love games.

Thanks for your ideas and Happy Holiday!

Foster