local ID1,ID2 local function SensorenEinlesen() local _,erg,sensor erg = system.getSensors() for _,sensor in ipairs(erg) do if sensor.param==0 then if sensor.label=="MULi1" then ID1=sensor.id end if sensor.label=="MULi2" then ID2=sensor.id end end end end local function Raster(x) local _ lcd.setColor(0,0,0,255) lcd.drawText(x,55,"1 2 3 4 5 6",FONT_MINI) lcd.setColor(150,150,150,255) for _=1,10 do lcd.drawLine(x,_*5+4,x+51,_*5+4) end lcd.setColor(255,0,0,255) lcd.drawLine(x,4,x+51,4) end local function Balken(x,ID) local Muli,V,_ local L,H,Z=10,0,0 lcd.setColor(0,0,0,255) for _=0,5 do V=system.getSensorValueByID(ID,_+1) if V then Muli=V.value if Muli~= 0 then if MuliH then H=Muli end if Muli>4.2 then Muli=4.2 end if Muli<3.2 then Muli=3.2 end end Muli=50*(Muli-3.2) if V.valid then lcd.drawFilledRectangle(_*9+x,55-Muli,6,Muli) else if(system.getTime() % 2 == 0) then lcd.drawFilledRectangle(_*9+x,55-Muli,6,Muli) end end end end if L==10 then L=0 end return L,H,Z end local function Fehler() lcd.setColor(200,0,0,255) lcd.drawText (10,25,"Keinen MULi1 gefunden!",FONT_MINI) end local function printForm() local L,H,Z,L2,H2,Z2,_,V lcd.setColor(0,0,0,255) lcd.drawText (115,2,"V Low",FONT_MINI) lcd.drawText (115,22,"Zelle",FONT_MINI) lcd.drawText (115,42,"Diff.",FONT_MINI) Raster(1) if ID1 then L,H,Z=Balken(1,ID1) end if ID2 then Raster(57) L2,H2,Z2=Balken (57,ID2) if L2H then H=H2 end else for _=0,5 do V=system.getSensorValueByID(ID1,_+1) if V then if V.value==0 then lcd.drawText(65,_*10+2,string.format("%01d. -",_+1),FONT_MINI) else lcd.drawText(65,_*10+2,string.format("%01d. %.2f",_+1,V.value),FONT_MINI) end else lcd.drawText(65,_*10+2,string.format("%01d. -",_+1),FONT_MINI) end end end lcd.setColor(150,0,20,255) lcd.drawText (115,12,string.format("%.2f",L),FONT_MINI) lcd.drawText (115,32,Z,FONT_MINI) lcd.drawText (115,52,string.format("%.2f",H-L),FONT_MINI) end local function init() SensorenEinlesen() if ID1 then if ID2 then system.registerTelemetry(1,"1-MULi 2-MULi",2,printForm) else system.registerTelemetry(1,"1-MULi Zellen",2,printForm) end else system.registerTelemetry(1,"Fehler...",2,Fehler) end end -------------------------------------------------------------------------------- return {init=init,author="PGK",version="0.10",name="MULi6"}