This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
cartmen180's profile picture

Openccsensors Help Needed

Started by cartmen180, 15 August 2013 - 04:33 PM
cartmen180 #1
Posted 15 August 2013 - 06:33 PM
Hello everyone,

I have started using openCCsensors and what i want to do is use the information i get from machines to display on a monitor.
For example the stored energy in various storage devices or heat in a couple of reactors.

When i use the sensorview program I can see the information but I have no clue how to send it to my control room.
Is there a wiki or tutorial i am missing?

This is my setup:
- advanced computer with monitors in a "control room"
- computers with sensors to read my nuclear reactors
- all the computer are hooked up with wireless modems

What i want to do:
send the energy output and heat readings to the control room.


any help would be greatly appreciated :)/>
(wasn't sure if i should post here or in peripheral help so i did both :3 )
Lyqyd #2
Posted 15 August 2013 - 09:40 PM
If you know your target's coordinates (which sensorview will tell you), you just need to use the sensor API and the getTargetDetails method to get the information table.


os.loadAPI("ocs/apis/sensor")
local sense = sensor.wrap("top") --replace top with actual side

while true do
  --get reactor data
  local reactorData = sense.getTargetDetails("-1,4,-3") --replace coordinates with actual coordinates.
  --you can use sensorview to figure out what you need to index in the details table
  print(reactorData.Heat)
  sleep(0.5)
end
cartmen180 #3
Posted 16 August 2013 - 03:08 AM
ty so much lyqyd! :D/>
i couldn't figure out how to use the getTargetDetails but now it is clear.
back to coding it is :)/>