Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
Smearfo

Issues pulling wireless card signals on an EEPROM.

Question

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")

while true do
  local signalname, receiver, sender, port, distance, message = computer.pullSignal()
  if signalname == "modem_message" then
    if 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")
    end
  end
end

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")

while true do
  local signalname, receiver, sender, port, distance, message = computer.pullSignal()
  if signalname == "modem_message" then
    if 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")
    end
  end
end

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

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.