Skip to content

Latest commit

 

History

History
38 lines (24 loc) · 779 Bytes

README.md

File metadata and controls

38 lines (24 loc) · 779 Bytes

SainSmart::NetworkIO

This gem provides a ruby frontend for SainSmart 16CH Relaycard, currently supported are only Network v2/v1 shields.

Installation

Add this line to your application's Gemfile:

gem 'sain_smart-network_IO'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sain_smart-network_IO

Usage

  # get net relay instance (IP: "192.168.1.4")
  r = SainSmart::NetworkIO::Relay.new(type: "16CH")
  ch = r.channel(<Int>) # Get channel object
  ch.on?  # Is on? -> v2 only
  ch.off? # Is off? -> v2 only
  r.channels.each(&:on!)  # Enable all
  r.channels.each(&:off!) # Disable all

License

The gem is available as open source under the terms of the MIT License.