class Ptt
Turn on / off RTS and DTR pins on a serial line Initialize:
>> s = Ptt.new("/dev/tty.usbserial")
Arguments:
port: (String)
Turn RTS / DTR on:
s.on
Turn RTS / DTR off:
s.off
Analyze State:
s.state
Public Class Methods
new(port)
click to toggle source
Arguments:
port: (String)
# File lib/simplePtt.rb, line 27 def initialize(port) begin @@sp = SerialPort.new(port,9600) @@sp.rts = 0 @@sp.dtr = 0 @@state = 0 rescue @@sp = nil @@state = -1 end end
Public Instance Methods
off()
click to toggle source
# File lib/simplePtt.rb, line 53 def off begin @@sp.dtr = 0 @@sp.rts = 0 @@state = 0 rescue @@state = -1 end end
on()
click to toggle source
# File lib/simplePtt.rb, line 43 def on begin @@sp.dtr = 1 @@sp.rts = 1 @@state = 1 rescue @@state = -1 end end
state()
click to toggle source
# File lib/simplePtt.rb, line 39 def state @@state end