Posted 26 September 2012 - 09:40 PM
Hi guys,
I've been playing around with CC and Sensors to get some information for a control program for a mine.
The sensor I have is to monitor the engines and I have got all the information I need, all accept the actual readings I am struggling to get the exact info I need.
Code is as follows:
So what I am trying to eventually display to the user is something like:
Right Engine Temp = Yellow
Left Engine Temp = Red
Bottom Engine Temp = Yellow
obviously colours dependant on the actual engine state :P/>/>!
Hope this all makes sense, and I would appreciate anyones help.
Cheers
PS - Yes I have trawled through Google/Forums/WIKI's etc and I'm all searched out.
I've been playing around with CC and Sensors to get some information for a control program for a mine.
The sensor I have is to monitor the engines and I have got all the information I need, all accept the actual readings I am struggling to get the exact info I need.
Code is as follows:
function printDict(data)
for i,v in pairs(data) do
print(tostring(i).." - "..tostring(v))
end
end
ctrl = sensors.getController()
mySensor = sensors.getSensors(ctrl)
mySensor = mySensor[1]
sensorInfo = sensors.getSensorInfo(ctrl,mySensor)
myProbes = sensors.getProbes(ctrl,mySensor)
myProbes = myProbes[3]
myTargets = sensors.getAvailableTargetsforProbe(ctrl,mySensor,myProbes)
rightEng = myTarget[1]
leftEng = myTargets[2]
bottomEng = mytargets[3]
rEngInfo = sensors.getSensorReadingAsDict(ctrl,mySensor,rightEng,myProbes)
rEngTemp = -- This needs to be the engine.energyStage variable and this is the part that falls over and I cannot get the information for this. I have tried rEngInfo[8] and engine.energyStage and neither produces the "colour" of the engine temp.
So what I am trying to eventually display to the user is something like:
Right Engine Temp = Yellow
Left Engine Temp = Red
Bottom Engine Temp = Yellow
obviously colours dependant on the actual engine state :P/>/>!
Hope this all makes sense, and I would appreciate anyones help.
Cheers
PS - Yes I have trawled through Google/Forums/WIKI's etc and I'm all searched out.