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

ccsensors api problem

Started by iStone, 14 October 2012 - 12:39 AM
iStone #1
Posted 14 October 2012 - 02:39 AM
Hi i followed this guide - http://www.youtube.com/watch?v=34R4KfLmMSY

But when i try to use getSensorReadingAsDict(side,sensor,target,probe,…)

It returns nothing

my messy code:


function printDict(data)
for i,v in pairs(data) do
  print(tostring(i).." - "..tostring(v))
end
end
ctrl = sensors.getController()
-- print(ctrl)
data = sensors.getSensors(ctrl)
-- printDict(data)

motorOneSensor = data[1];

data = sensors.getSensorInfo(ctrl,motorOneSensor)
-- printDict(data)
data = sensors.getProbes(ctrl,motorOneSensor)
-- printDict(data)
combustionMotorOneProbe = data[5]

sensors.setTarget(ctrl,motorOneSensor,combustionMotorOneProbe)

data = sensors.getAvailableTargetsforProbe(ctrl,motorOneSensor,combustionMotorOneProbe)
-- printDict(data)

motorOneTarget = data[1]
data = sensors.getSensorReadingAsDict(ctrl,motorOneSensor,motorOneTarget,combustionMotorOneProbe)
printDict(data)
remiX #2
Posted 14 October 2012 - 03:11 AM
Followed what guide?
iStone #3
Posted 14 October 2012 - 03:24 AM
Sorry somehow forgot to link to youtube :)/>/>
iStone #4
Posted 15 October 2012 - 07:55 AM
Anyone got some tips? :D/>/>