sample lua script:
i2c.setup(0, 4, 3, i2c.SLOW);
i2c.start(0);
i2c.address(0, 0x27, i2c.TRANSMITTER);
i2c.write(0, 0,"CL","TP",0,0,"TT","LFT",0,"TP",12,0,"TT","RGT",0,"TP",2,2,"TT","some here",0,"TP",4,4,"TT","some here",0);
i2c.stop(0);
-- self documenting long function name
function LetsHaveABeer(beer, ltrs, mids, temp)
if beer == nil or ltrs == nil or mids == nil or temp == nil then
print("Argument missing, need string:beer, string:ltrs, string:mids, string:temp");
end
--6,10,18,51,120,123,0
i2c.setup(0, 4, 3, i2c.SLOW);
i2c.start(0);
i2c.address(0, 0x27, i2c.TRANSMITTER);
-- battery
-- between 1 - 10
-- TODO
power = 10;
i2c.write(0, 0,"CL","DR",112,0,126,10,"LN",127,2,127,8,"FR",114,2,power+114,8);
-- wifi
-- between 1 - 5
-- TODO
strength = 3;
type = "FR";
for i=0,4 do
if strength <= i then
type = "DR"
end
i2c.write(0,type,93+i*4,8-i*2,91+i*4,10);
end
-- info
i2c.write(0,"TP",0,0,"TT","T1 " .. temp.."C",0,"TP",2,2,"SF",18,"TT",beer,0,"SF",0,"TP",0,4,"TT",ltrs .."L",0,"TP",10,4,"TT", mids .. "M",0);
i2c.stop(0);
end
Hopefully helps some projects along.
Cheers.