local Muli1,Muli2 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 Muli1=sensor.id end if sensor.label=="MULi2" then Muli2=sensor.id end end end end local function printForm() local Muli,V,Z,_ local L,H=10,0 lcd.drawText (1,55,"1 2 3 4 5 6 1 2 3 4 5 6",FONT_MINI) lcd.drawText (115,2,"V Low",FONT_MINI) lcd.drawText (115,22,"Zelle",FONT_MINI) lcd.drawText (115,42,"Diff.",FONT_MINI) lcd.setColor(150,150,150,255) for _=1,10 do lcd.drawLine(1,_*5+4,108,_*5+4) end lcd.setColor(255,0,0,255) lcd.drawLine(1,4,108,4) lcd.setColor(0,0,0,255) for _=0,5 do V=system.getSensorValueByID(Muli1,_+1) Muli=V.value if MuliH then H=Muli end if Muli>4.2 then Muli=4.2 end if Muli<3.2 then Muli=3.2 end Muli=50*(Muli-3.2) if V.valid then lcd.drawFilledRectangle(_*9+1,55-Muli,6,Muli) else if(system.getTime() % 2 == 0) then lcd.drawFilledRectangle(_*9+1,55-Muli,6,Muli) end end V=system.getSensorValueByID(Muli2,_+1) Muli=V.value if MuliH then H=Muli end if Muli>4.2 then Muli=4.2 end if Muli<3.2 then Muli=3.2 end Muli=50*(Muli-3.2) if V.valid then lcd.drawFilledRectangle(_*9+58,55-Muli,6,Muli) else if(system.getTime() % 2 == 0) then lcd.drawFilledRectangle(_*9+58,55-Muli,6,Muli) end end end lcd.drawText (115,12,string.format("%.3f",L),FONT_MINI) lcd.drawText (115,32,Z,FONT_MINI) lcd.drawText (115,52,string.format("%.3f",H-L),FONT_MINI) end local function init() SensorenEinlesen() system.registerTelemetry(1,"1-MULi6s 2-MULi6s",2,printForm) end -------------------------------------------------------------------------------- return {init=init,loop=loop,author="PGK",version="0.01",name="MULi6s"}