以下为文章正文
Cu8 datatemp[512];
os_memset(datatemp,0,512);
os_sprintf(datatemp,"#baotou#drivesave#%s#computer#m#p#o#online#1#2#3#4#5#6#7#8#9#",MacAddress);
espconn_send(&ST_NetCon,datatemp,os_strlen(datatemp));
Cif(gpio==0)
{
os_sprintf(sendbufftemp,"#baotou#driveupdata#%s#computer#%s#password#state#on#1#2#3#4#5#6#7#8#9#",MacAddress,MacAddress);
}
else
{
os_sprintf(sendbufftemp,"#baotou#driveupdata#%s#computer#%s#password#state#off#1#2#3#4#5#6#7#8#9#",MacAddress,MacAddress);
}
Cif(gpioold!=gpio)
{
gpioold=gpio;
timetoupdataudpserver=100;
os_printf("SYS:变了 \r\n");
u8 datatemp[512];
os_memset(datatemp,0,512);
os_sprintf(datatemp,"#baotou#drivesave#%s#computer#m#p#o#change#%d#2#3#4#5#6#7#8#9#",MacAddress,gpioold);
espconn_send(&ST_NetCon,datatemp,os_strlen(datatemp));
}
cif(!os_memcmp(pdata,"#baotou#control#",os_strlen("#baotou#control#")))
{
timetoupdataudpserver=100;
if(breakcnt>3)
{
u8 cmd[20];
os_memset(cmd,0,20);
os_memcpy(cmd,pdata+breaknum[3]+1,breaknum[4]-breaknum[3]-1);
os_printf("SYS:%s\r\n",cmd);
if(!os_memcmp(cmd,"on",os_strlen("on")))
{
os_printf("SYS:开机\r\n",cmd);
timetoupdataudpserver=100;
switchtime=1;
u8 datatemp[512];
os_memset(datatemp,0,512);
os_sprintf(datatemp,"#baotou#drivesave#%s#computer#m#p#o#switch#on#2#3#4#5#6#7#8#9#",MacAddress);
espconn_send(&ST_NetCon,datatemp,os_strlen(datatemp));
}
else if(!os_memcmp(cmd,"off",os_strlen("off")))
{
os_printf("SYS:关机\r\n",cmd);
timetoupdataudpserver=100;
switchtime=10;
u8 datatemp[512];
os_memset(datatemp,0,512);
os_sprintf(datatemp,"#baotou#drivesave#%s#computer#m#p#o#switch#off#2#3#4#5#6#7#8#9#",MacAddress);
espconn_send(&ST_NetCon,datatemp,os_strlen(datatemp));
}
}
}
http://kellermen.top:1009/pcb/049/
长按配网按钮后,LED指示灯常亮。打开安信可公众号,使用配网功能进行配网。
配网完成后,根据指示灯来判断工作状态。
LED状态 | 工作模式 |
---|---|
常亮 | 正在进行微信配网 |
快闪 | 正在搜网 |
慢闪 | 正常工作 |
在关机状态下。点击开机按钮,模块按下按钮1S。
Cswitchtime=1;
在开机状态下。点击开机按钮,模块按下按钮10S。
Cswitchtime=10
本文作者:Kellermen
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!