Project

myfirmata

0.0
No commit activity in last 3 years
No release in over 3 years
The MyFirmata gem uses the ArduinoFirmata gem to trigger messages and listen for actionable messages using the SimplePubSub messaging system
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.3.7, ~> 0.3
>= 0.3.3, ~> 0.3
 Project Readme

Introducing the MyFirmata gem

require 'myfirmata'
require 'myfirmata-plugin-button'

mf = MyFirmata.new device_name: 'jessie', sps_address: '192.168.4.135',\
  plugins: {Button: {pin: 2} }
mf.start

The MyFirmata gem facilitates publishing and subscribing message to or from the SimplePubSub broker given the events triggered from the Arduino or instructions to be actioned by the Arduino.

In the above example the MyFirmata plugin listens for button presses (on digital pin 2) and then publishes them to the SPS broker at 192.168.4.135 on port 59000.

Output: Observed the following when the button was pressed 5 times:

MyFirmata/jessie: button pressed
MyFirmata/jessie: button pressed
MyFirmata/jessie: button pressed
MyFirmata/jessie: button pressed
MyFirmata/jessie: button pressed

Note: The button press event is ignored if the button is pressed less than a second ago since the last button press.

Resources

firmata arduino button plugin myfirmata