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

Sensor turtles and inventory sensors OpenCCSensors.

Started by g1eagle, 29 June 2013 - 11:45 AM
g1eagle #1
Posted 29 June 2013 - 01:45 PM
I hope I'm doing this correctly..
I'm trying to use a sensor turtle but I'm unable to get it to reconise a sensor card, and there seems to be almost no information on how one would go about getting the turtle to do such…


Also can you use a inventory sensor to tell the name of the item in an inventory? I can get it to pull up the name of the inventory but I can not figure out how to get the individual items in said inventory.
Lyqyd #2
Posted 29 June 2013 - 03:13 PM
Split into new topic.

Is the sensor card in slot 16?
g1eagle #3
Posted 30 June 2013 - 03:38 AM
Yes the sensor card is in slot 16.
But it returns nil when I try and pull information from it.
Lyqyd #4
Posted 30 June 2013 - 04:04 AM
Please post the code you're using.
g1eagle #5
Posted 30 June 2013 - 11:37 AM
os.loadAPI("ocs/apis/sensor")
mySensor = sensor.wrap("left")
targets = mySensor.getTargets()

for k, v in pairs(targets) do
print(mySensor.getTargetDetails(k))
end


Though I figured out that problem.. I had a capital letter where it didn't belong…

The other issue of how do we get the slot information?
Lyqyd #6
Posted 30 June 2013 - 01:52 PM
You use the Slots table contained in the table that getTargetDetails returns.

Try running ocs/programs/sensorview to see what is available for the targets.
g1eagle #7
Posted 30 June 2013 - 03:04 PM
Thanks for the help.
I figured it out.. this can be marked as solved..