Skip to content
/ tosr0x Public

Ruby gem to provide an API to interact with the TOSR0x relays sold by the TinySine.

License

Notifications You must be signed in to change notification settings

bithium/tosr0x

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TOSR0x

This gem provides an API to interact with the TOSR0x relays sold by the TinySine.

Installation

Add this line to your application's Gemfile:

gem 'tosr0x'

And then execute:

$ bundle

Or install it yourself as:

$ gem install tosr0x

Usage

Please the following code for an example on using this gem.

require 'tosr0x'

RELAY_PORT  = '/dev/ttyUSB0' # Change this to the serial port that belongs to the relay.
RELAY_COUNT = 8              # Change this to indicate the number of relays in the board.

board = TOSR0x::Board.new(RELAY_PORT, RELAY_COUNT)

# Enable all relays

board.enable(:all)   # or
board.enable(0)      # or
board.disable(:none)

# Disable all relays

board.disable(:all)   # or
board.disable(0)      # or
board.enable(:none)

# We can also enable individual relays
relay = board.get(1)

relay.enable     # or
board.enable(1)

# ... disable individual relays
relay.disable     # or
board.disable(1)

# ... and even toggle them
relay.toggle     # or
board.toggle(1)

For more options please see the documentation generate by YARD.

Development

Use the normal flow when using Bundler and RSpec.

Also the guidelines from Git Flow

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/bithium/tosr0x.

License

MIT (see LICENSE)

About

Ruby gem to provide an API to interact with the TOSR0x relays sold by the TinySine.

Resources

License

Stars

Watchers

Forks

Packages

No packages published