rule1
on rules#timer=1 do backlog displaytext [x0y-2s1f2C1B0t][x0y17h128][x0y63h128];ruletimer1 %mem1% endon
on System#Boot do backlog ruletimer1 5;ruletimer2 5 endon
on Var7#state do displaytext [x92y1s2f1C0B1]%value% endon
on var8#state do displaytext [x84y48p-6C1B0f1]%value% endon
on var9#state do displaytext [x0y48p12C1B0f1]%value% endon
on var10#state do displaytext [x4y22p-7C1B0f2]%value% endon
输入“rule1 1”,启用规则。
规则2:参数部分(将以下8行一次性复制,在控制台粘贴并回车)
rule2
on rules#timer=2 do add16 1 endon
on var16#state do ruletimer2 %mem2% endon
on var16#state>=5 do backlog var8 W;var9 Power;var10 %var15%;var16 0 endon
on var16#state==4 do backlog var8 A;var9 Curren;var10 %var14% endon
on var16#state==3 do backlog var8 V;var9 Voltage;var10 %var13% endon
on var16#state==2 do backlog var8 kWh;var9 Today;var10 %var12% endon
on var16#state==1 do backlog var8 kWh;var9 Remain;var10 %var11% endon
如果SSD1306显示了,恭喜你,基本完成了ESP01驱动SSD1306的试验,如果没有显示,请在控制台输入“i2cscan”,查看i2c扫描结果。如果显示 {"I2CScan":"Device(s) found at 0x3c"}“,表示i2c连接正常,输入“power on”,也许就显示了,如果还没有显示,输入“restart 1”,重启ESP01。