No commit activity in last 3 years
No release in over 3 years
A MyFirmata plugin to control 1 or more LEDs via a SimplePubSub subscription.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.1.0, ~> 0.1
 Project Readme

Controlling an LED hooked up to an Arduino using MyFirmata

Example

require 'myfirmata'
require 'myfirmata-plugin-led'

mf = MyFirmata.new device_name: 'jessie', sps_address: '192.168.4.135',\
  plugins: {Led: {pins: [12, 11, 10]} }
mf.start

The above example demonstrates using 3 LEDs connected to an Arduino which has the Firmata sketch uploaded to it and is controlled using the MyFirmata gem with the MyFirmata LED plugin.

Setting the LEDs on or off

require 'sps-pub'

SPSPub.notice 'MyFirmata/jessie/output/led: 0 on' # set the blue LED on
SPSPub.notice 'MyFirmata/jessie/output/led: 0 off' # set the blue LED off

SPSPub.notice 'MyFirmata/jessie/output/led: 1 on' # set the green LED on
SPSPub.notice 'MyFirmata/jessie/output/led: 1 off' # set the green LED off

SPSPub.notice 'MyFirmata/jessie/output/led: 2 on' # set the red LED on
SPSPub.notice 'MyFirmata/jessie/output/led: 2 off' # set the red LED off

It's worth noting that the MyFirmata setup is suitable for use with any computer which can control an Arduino through a USB connection.

Resources

myfirmata firmata led plugin gem