args = {...}
if #args < 1 then
  print("Usage: wrpulse frequency")
  return
end

frequency = tonumber(args[1])
if frequency == nil or frequency < 1 or frequency > 5000 then
  print("Invalid frequency number")
  return
end

rether = nil
retherSide = nil
for i, side in pairs(rs.getSides()) do
  if peripheral.getType(side) == "wirelessRedstone" then
    rether = peripheral.wrap(side)
    retherSide = side
    break
  end
end

if rether == nil then
  print("No REther peripheral found")
  return
end

print("Using REther peripheral on "..retherSide)

rether.setFreq(frequency)
rether.set(true)
sleep(0.1)
rether.set(false)

print("Pulsed on frequency "..frequency)