6 posts
Posted 04 February 2014 - 05:29 PM
hi
How can I use OpenPeripheral over lan?
I only found a tutorial for the old system without channels:
http://www.computerc...attery-monitor/For example I would like to read the EUCapacity of a batbox.
If I put the batbox beside the PC, I can read the data very simple. but how does this work if I conect two or more over lan/wlan
I hope someone can help me.
aligator123456
Edited on 05 February 2014 - 09:42 AM
63 posts
Location
Mannin
Posted 04 February 2014 - 06:09 PM
attach a wired modem to the batbox, then activate it by right clicking on the modem… cable to the computer, with a modem on that too…
then the batbox, from memory, should be "batbox_0" - this should be confirmed when you right-click the modem on the batbox itself, the _0 bit changes for each modem you attach to each batbox
you can then read the capacity with peripheral.wrap("batbox_0").getEUStored() - change batbox_0 to whatever yours is called obviously.
7508 posts
Location
Australia
Posted 04 February 2014 - 08:19 PM
in addition to what ingie stated, when you activate the modem on the batbox it will tell you its name in your chat — this is what he means by "confirmed".
it should also be noted that when you're putting any non-solid block — for example chests — onto a network as opposed to directly beside the computer you must make use of the Peripheral Proxy as well as the modem.
lastly it should also be pointed out that if you have multiple devices on a network of the same type and you wish to use them all you can generically loop through and use them all like so
for _, name in pairs(peripheral.getNames()) do
if peripheral.getType(name) == "batbox" then
-- it was a batbox, do what you wish with it here
end
end
6 posts
Posted 05 February 2014 - 10:42 AM
Thank you!
it works great.
aligator123456