Skip to content

jrobertson/myfirmata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

The MyFirmata gem uses the ArduinoFirmata gem to trigger messages and listen for actionable messages using the SimplePubSub messaging system

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages