Sha256: 5c1c0968bea1fb2b932597acbae84e506e8fc3fb7e3dfc71802a0a44300aba02

Contents?: true

Size: 1.28 KB

Versions: 4

Compression:

Stored size: 1.28 KB

Contents

#! /usr/bin/ruby
# -*- coding: utf-8; mode: ruby -*-
# Function:
#   Lazurite Sub-GHz/Lazurite Pi Gateway Sample program
#   SerialMonitor.rb
#require 'LazGem'
require 'LazGem'

laz = LazGem::Device.new

# Halt process when CTRL+C is pushed.
finish_flag=0
Signal.trap(:INT){
	finish_flag=1
}
if ARGV.size < 1
	printf("please input argument of ch at least 1\n")
	printf("command format is shown below...\n")
	printf("./sample_tx.rb ch panid ieee_addr baud pwr\n")
	printf("  ch:    24-61\n")
	printf("  panid: 0-0xffff\n")
	printf("  ieee..:0x001d....\n")
	printf("  baud:  50 or 100\n")
	printf("  pwr:   1 or 20\n")
	exit 0
end

# open device deriver
laz.init()

ieee_addr = 0x001D129000045F6B
ch = 36
panid = 0xabcd
baud = 100
pwr = 20

if ARGV.size > 0
	ch=Integer(ARGV[0])
end
if ARGV.size > 1
	panid = Integer(ARGV[1])
end
if ARGV.size > 2
	ieee_addr = Integer(ARGV[2])
end
if ARGV.size > 3
	baud = Integer(ARGV[3])
end
if ARGV.size > 4
	pwr = Integer(ARGV[4])
end

i = 0
# main routine
while finish_flag == 0 do
	begin
	laz.begin(ch,panid,baud,pwr)
	rescue Exception => e
		p "file io error!! reset driver"
		laz.remove()
		laz.init()
	end
	begin
		laz.send64(ieee_addr,"LAPIS Lazurite RF system")
	rescue Exception => e
		p e
		sleep 1
	end
	laz.close()
	sleep 1.000
end

# finishing process
laz.remove()


Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
LazGem-0.1.4 sample/sample_tx64.rb
LazGem-0.1.3 sample/sample_tx64.rb
LazGem-0.1.2 sample/sample_tx64.rb
LazGem-0.1.1 sample/sample_tx64.rb