|
本帖最后由 lc1148207228 于 2019-12-14 10:40 编辑
最近用STC15W4K单片机做了一个全彩12864 WIFI时钟 温湿度,35MHZ刷新率53HZ~56HZ
WIFI模块 ESP8266 网页修改WIFI账号密码 一次修改 永久使用
模块化编程 带模块化菜单功能功能演示
https://v.youku.com/v_show/id_XNDM4NjI0Mzg0OA==.html?spm=a2hbt.13141534.app.5~5~5!2~5~5~5!2~5~5!2~5!2~5!2~5~5~A
大数字时钟
https://v.youku.com/v_show/id_XNDM4NjIzODEzMg==.html?spm=a2hbt.13141534.app.5~5~5!2~5~5~5!2~5~5!2~5!2~5!2~5~5!2~A
模拟时钟
https://v.youku.com/v_show/id_XNDM4NjI0MDM5Ng==.html?spm=a2hbt.13141534.app.5~5~5!2~5~5~5!2~5~5!2~5!2~5!2~5~5!3~A
多字体翻页时钟
https://v.youku.com/v_show/id_XNDM4NjIzNTc3Ng==.html?spm=a2hbt.13141534.app.5~5~5!2~5~5~5!2~5~5!2~5!2~5!2~5~5!4~A
菜单功能程序
unsigned char ProjectName[]="Menu System"; //项目名称
char Menu_index = 1; //菜单显示与正常显示标识
char xdata DisplayStart = 0; //显示菜单的开始位置
char xdata UserChoose = 0; //用户的选择
char xdata DisplayPoint = 0; //显示菜单的编号
char xdata MaxItems = 0; //菜单的数量
char xdata Option = 0; //保存用户的菜单编号
void NULL_Function(void) //空函数
{
;
}
void Exit();
//二级菜单
struct MenuItem code SysTemSet[8]; //这里不声明一下,MainMenu里不能引用
//*------------------------------------------------------------------------------
//*目录结构体定义
//*------------------------------------------------------------------------------
struct MenuItem //结构体名称
{ unsigned char MenuCount; //当前层节点数、每层菜单能显示的条目数
unsigned char *DisplayString; //指向菜单标题的字符串
unsigned char (*Subs)(); //指向当前状态应该执行的功能函数
struct MenuItem *ChildrenMenus; //指向当前菜单的下级菜单
struct MenuItem *ParentMenus; //指向当前菜单的上级菜单
} MENU_NULL;
struct MenuItem code MainMenu[4] = //结构体主菜单
{
{4,"SYSTEM SET",&NULL_Function,&SysTemSet,&MENU_NULL},
{4,"Clock Mode",&Clock_mode_selection,&MENU_NULL,&MENU_NULL},
{4,"Serial Port",&Uart1,&MENU_NULL,&MENU_NULL},
{4,"About",&About,&MENU_NULL,&MENU_NULL},
};
WIFI模块 ESP8266部分程序
uart.setup(1, 9600, 8, uart.PARITY_NONE, uart.STOPBITS_1, 1)
print("ESP8266 WIFI time service system")
print("TX0:115200 TX TX1:9600 D4")
--mytimer = tmr.create()
--mytimer1:alarm(1000, tmr.ALARM_SINGLE, function()
mytimer:alarm(10000, tmr.ALARM_SEMI, function()
--mytimer1:alarm(5000, tmr.ALARM_AUTO, function()
mytimer:start()
if wifi.sta.getip() ~= nil then
sntp.sync({"ntp1.aliyun.com","ntp.ntsc.ac.cn","ntp2.aliyun.com"},
function(sec, usec, server, info)
--print('sync', sec, usec, server,info)
gpio.write(0, gpio.LOW)
secs = rtctime.get()
secs = secs + 8*3600
time = rtctime.epoch2cal(secs)
uart.write(1,string.format("@#%04d/%02d/%02d %02d:%02d:%02d %03d %01d",
time["year"],
time["mon"],
time["day"],
time["hour"],
time["min"],
time["sec"],
time["yday"],
time["wday"]))
print(string.format("@#%04d/%02d/%02d %02d:%02d:%02d %03d %01d",
time["year"],
time["mon"],
time["day"],
time["hour"],
time["min"],
time["sec"],
time["yday"],
time["wday"]))
gpio.write(0, gpio.HIGH)
end,
function()
print('failed!')
end)
end
end)
补充内容 (2019-12-16 11:19):
网盘链接
链接:https://pan.baidu.com/s/1ayHAhhfNTP96Dy321FVDYQ
提取码:zspz |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
打赏
-
查看全部打赏
|