首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >esp01s ntp TM1637 数码管时钟源代码

esp01s ntp TM1637 数码管时钟源代码

作者头像
master336
发布2026-06-15 19:51:54
发布2026-06-15 19:51:54
90
举报

通过TM1637 及esp01的网路功能实现数字网络时钟

代码语言:javascript
复制
#include <NTPClient.h>
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include "TM1637.h"
//TM1637  针脚定义
#define CLK 0     
#define DIO 2
TM1637 tm1637(CLK,DIO);
// wifi 信息定义
const char *ssid     = "haha";
const char *password = "haha12345678@";

WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP,"ntp1.aliyun.com",60*60*8,30*60*1000);

int update = 0;
int delaycount= 20;
int currentHour = 88;
int currentMinute = 88;

void setup()
{
  Serial.begin(9600);
  tm1637.init();
  tm1637.set(BRIGHT_TYPICAL);//BRIGHT_TYPICAL = 2,BRIGHT_DARKEST = 0,BRIGHTEST = 7;
  WiFi.begin(ssid, password);
  while ( WiFi.status() != WL_CONNECTED ) {    
    tm1637.point(POINT_ON);
    infoTime(currentHour/10,currentHour%10,currentMinute/10,currentMinute%10);
    delay ( 500 );
    Serial.print ( "." );
  }
  timeClient.begin();
}
void loop()
{
   if (update % 2 == 0)
   {
      tm1637.point(POINT_
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2026-06-15,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 通过TM1637 及esp01的网路功能实现数字网络时钟
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档