So I've been working on a simple program to remotely control a zetta industries FU meter by having a tablet send wireless messages to a connected computer, but I'm having some issues, namely in getting the computer to detect the signals sent from the tablet.
Firstly I have a computer with tier 1 wireless card, and an eeprom running this program:
local modem = component.proxy(component.list("modem")())local meter = component.proxy(component.list("rfmeter")())
modem.open(122)
modem.setWakeMessage("activate")whiletruedolocal signalname, receiver, sender, port, distance, message = computer.pullSignal()if signalname =="modem_message"thenif tonumber(message)then
meter.setOn()
meter.setCounterMode(false)
meter.setEnergyCounter(tonumber(message))
modem.broadcast(sender,123,"Successfully set power to ".. message)elseif message =="freeze"then
meter.setOff()
modem.send(sender,123,"Successfully froze power")elseif message =="unfreeze"then
meter.setOn()
modem.send(sender,123,"Successfully unfroze power")else
modem.send(sender,123,"Badly formatted request sent")endendend
Then I have a tablet with a tier 2 wireless card running this:
local component = require("component")local event = require("event")local modem = component.modem
modem.open(123)
print("Please enter your command")local message = io.read()
modem.broadcast(122, message)local _, _, sender, _, _, response = event.pull("modem_message")
print("Response received from ".. sender ..": ".. response)
The main issue seems to be in getting the computer to detect the signals sent by the tablet, it seems to detect other signals fine, and the wakemessage works fine too, and moreover, when I change the code this:
local component = require("component")local computer = require("computer")local modem = component.modem
local meter = component.rfmeter
modem.open(122)
modem.setWakeMessage("activate")whiletruedolocal signalname, receiver, sender, port, distance, message = computer.pullSignal()if signalname =="modem_message"thenif tonumber(message)then
meter.setOn()
meter.setCounterMode(false)
meter.setEnergyCounter(tonumber(message))
modem.send(sender,123,"Successfully set power to ".. message)elseif message =="freeze"then
meter.setOff()
modem.send(sender,123,"Successfully froze power")elseif message =="unfreeze"then
meter.setOn()
modem.send(sender,123,"Successfully unfroze power")else
modem.send(sender,123,"Badly formatted request sent")endendend
and run it as a normal OpenOS file, it all works without issue, what is it that I'm missing?
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
So I've been working on a simple program to remotely control a zetta industries FU meter by having a tablet send wireless messages to a connected computer, but I'm having some issues, namely in getting the computer to detect the signals sent from the tablet.
Firstly I have a computer with tier 1 wireless card, and an eeprom running this program:
Then I have a tablet with a tier 2 wireless card running this:
The main issue seems to be in getting the computer to detect the signals sent by the tablet, it seems to detect other signals fine, and the wakemessage works fine too, and moreover, when I change the code this:
and run it as a normal OpenOS file, it all works without issue, what is it that I'm missing?
Link to post
Share on other sites