/FirmataAmbassador

Sort of driver to work with Firmata firmware connected to USB. Lang: Lua. OS: Linux.

Primary LanguageLuaGNU General Public License v3.0GPL-3.0

Working with Firmata (v2.5) in Lua

Status

Working prototype

Requirements

OS: Linux
Language: Lua 5.3

Core functions implemented

  • Get object: local Firmata = request('Firmata.Ambassador.Interface')
  • Digital pin 3 read: Firmata:DigitalRead(3)
  • Digital pin write: Firmata:DigitalWrite({ Pin = 13, Value = true })
  • Analog pin A0 read: Firmata:AnalogRead(0)
  • Analog (PWM) pin write: Firmata:AnalogWrite({ Pin = 3, Value = 1 / 256 })
  • I2C device read: Firmata:I2cRead({ DeviceId = 0x68, Offset = 0x00, NumBytes = 0x13 })
  • I2C device write: Firmata:I2cWrite({ DeviceId = 0x68, Offset = 0x00, Data = { 0x02, 0x52, 0x16 } })

First launch

  • Clone
  • Connect Arduino
    • Flash Arduino with StandardFirmata
  • Run $ ./CLI_SmokeTest.lua
    • If it fails, change there local PortName = '/dev/ttyUSB0' to your port name.
      • If it still fails, create an issue.

Notes

  • For simple demo look to CLI_SmokeTest.lua.

  • As a sediments, there are set of command-line tools to get/parse/compile/set time from real-time clock module on DS3231. But I'll throw them later.

See also

2023-06-13