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

File not found error (ccSensors API)

Started by Zamithal, 18 December 2012 - 03:58 PM
Zamithal #1
Posted 18 December 2012 - 04:58 PM
So today I started learning ComputerCraft and ccSensors. Everything was working well until I tried making an infinite loop (with no break). Not knowing how to stop the program, I broke the computer. Now, whenever I use the
os.unloadAPI("sensors")
os.loadAPI("/rom/apis/sensors")
commands it returns a "File not found" error.
because the API is gone it breaks the rest of my code, any ideas on what I did wrong?

(I know people usually ask to see the code so here:)

os.unloadAPI("sensors")
os.loadAPI("/rom/apis/sensors")

function printDict(data)
for i,v in pairs(data) do
  print(tostring(i).." - "..tostring(v))
end
end

mon = peripheral.wrap("top")
shell.run("monitor", "top", "clear")
shell.run("clear")

ctrl = sensors.getController()

--printDict(data)
---------------------------getReactorInformation-----------------------------------
data = sensors.getSensors(ctrl)

reactor = data[2]
data = sensors.getSensorInfo (ctrl,reactor)
data = sensors.getProbes(ctrl,reactor)
reactorProbe = data[2]
data = sensors.getAvailableTargetsforProbe(ctrl,reactor,reactorProbe)
ReactorPos = data[1]
data = sensors.getSensorReadingAsDict(ctrl,reactor,ReactorPos,reactorProbe)
---------------------printReactorInformation--------------------------
--printDict(data)
mon.setTextScale(0.5)
mon.write("Reactor heat: (")
mon.setCursorPos(16,1)
mon.write( data.heat)
mon.write( "/12000) (")
mon.write( data.heat/12000*100)
mon.write( "%)" )
----------------------getMFSUInformation-----------------------------------
data = sensors.getSensors(ctrl)
MFSU = data[1]
data = sensors.getSensorInfo (ctrl,MFSU)
data = sensors.getProbes(ctrl,MFSU)
MFSUProbe = data[3]
data = sensors.getAvailableTargetsforProbe(ctrl,MFSU,MFSUProbe)
MFSUPos = data[1]
data = sensors.getSensorReadingAsDict(ctrl,MFSU,MFSUPos,MFSUProbe)
---------------------printReactorInformation--------------------------
mon.setCursorPos(1,2)
mon.write("Main power supply: (", data.energy, "/", data.maxStorage, ") (", data.energy/data.maxStorage*100, "%)" )
Zamithal #2
Posted 18 December 2012 - 07:18 PM
I apologize for asking this question, hours later I realised that when I destroyed the computer, I also took out the sensor controller… That was a lot of waisted time :/ silly me…