Posted 09 June 2014 - 12:26 AM
Hello guys,
Im trying to set up a simple programs here to make 1 computer with a CCsensor (Tank) + Wireless Modem to get Amount data from tanks near and send to another computer, far away (less than 64 blocks for modem reach) that will display it on a monitor. Here what i did so far, the send code seams ok but i dont know if i made the receive code right, its just showing crazy numbers on the monitor instead of the Amount.
SEND PROGRAM:
RECEIVE/DISPLAY PROGRAM:
http://pastebin.com/ZmS9NTmE
http://pastebin.com/N1q3sDVD
i also tried to put (moreDetails.Tanks[1].Amount) instead of (messageArguments), dont work too
Im trying to set up a simple programs here to make 1 computer with a CCsensor (Tank) + Wireless Modem to get Amount data from tanks near and send to another computer, far away (less than 64 blocks for modem reach) that will display it on a monitor. Here what i did so far, the send code seams ok but i dont know if i made the receive code right, its just showing crazy numbers on the monitor instead of the Amount.
SEND PROGRAM:
os.loadAPI("ocs/apis/sensor")
local modem = peripheral.wrap("bottom")
local sendOnChannel = 1
local replyChannel = 2
prox = sensor.wrap("top")
while true do
term.setCursorPos(1,3)
moreDetails = prox.getTargetDetails("3,0,0")
print(moreDetails.Tanks[1].Amount)
term.setCursorPos(1,4)
moreDetails = prox.getTargetDetails("-3,0,0")
print(moreDetails.Tanks[1].Amount)
modem.transmit(2,1,moreDetails.Tanks[1].Amount)
end
RECEIVE/DISPLAY PROGRAM:
local monitor = peripheral.wrap("top")
local modem = peripheral.wrap("back")
modem.open(2)
modem.open(1)
monitor.clear()
while true do
monitor.setCursorPos(1,1)
local messageArguments ={os.pullEvent("modem_message")}
monitor.write(messageArguments)
end
http://pastebin.com/ZmS9NTmE
http://pastebin.com/N1q3sDVD
i also tried to put (moreDetails.Tanks[1].Amount) instead of (messageArguments), dont work too