patlite

Version, currently master branch1 version
  • master branchlatestDec 28, 2016

github.com/arcage/crystal-patlite

Crystal library for controlling PATLITE signal towers by using PHN commands.

1 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  patlite:
    github: arcage/crystal-patlite
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
0.20.3
License
MIT
Author
ʕ·ᴥ·ʔAKJ

Dependencies

This version declares no dependencies.

README

Patlite for Crystal

Crystal library for controlling PATLITE signal towers by using PHN commands.

Installation

Add this to your application's shard.yml:

dependencies:
  patlite:
    github: arcage/crystal-patlite

Usage

require "patlite"

patlite_host = "192.168.0.100"
patlite_port = 10000

# initialize host(ip) and port for a signal tower
patlite = Patlite::PHN.new(patlite_host, patlite_port)

# set signal tower statuses
#
# You can set:
# - Light setting: `{{COLOR}}_{{PATTERN}}`
#
#    - `{{COLOR}}`   = red / yellow / green
#    - `{{PATTERN}}` = off / on / flash
#
# - Beep setting: `beep_{{PATTERN}}`
#
#    - `{{PATTERN}}` = off / short / long
patlite.set do
  red_on
  beep_long
end

# get signal tower statuses
status = patlite.status
status.red          #=> Patlite::PHN::Status::Light::ON
status.beep_short?  #=> false
puts status
#=> "RED:on / YELLOW:off / GREEN:off / BEEP:long"

sleep(2)

# add signal tower statuses to current settings
patlite.add do
  green_flash
  beep_off
end

puts patlite.status
#=> "RED:on / YELLOW:off / GREEN:flash / BEEP:off"

sleep(2)

# turn off all lights and beep
patlite.clear

puts patlite.status
#=> "RED:off / YELLOW:off / GREEN:off / BEEP:off"

Contributors

  • arcage ʕ·ᴥ·ʔAKJ - creator, maintainer