SKU:U146
UNIT-Digi-Clock是一款2.1英寸4位7段数码管模块,带有小数点(.
)和冒号(:
),可以显示小数点或者时间。采用TM1637驱动方案,驱动芯片选用STM32F030处理器进行I2C
通信,使用时用户能够将其挂载到现有设备的I2C总线中,起到节省IO的作用。通过配置4位拨码开关可以修改设备I2C地址
,红色发光数码管支持8级亮度调整。板上配置4个固定孔。
规格 | 参数 |
---|---|
处理器 | STM32F030 |
驱动芯片 | TM1637 |
通信接口 | I2C, addr: 0x30 |
供电电压 | 5V DC |
净重 | 12.5g |
毛重 | 17.8g |
产品尺寸 | 50 * 31 * 14mm |
包装尺寸 | 136 * 92 * 15mm |
环境 | DC5V下电流值 |
---|---|
待机(全关) | 2.5mA |
SG1 | 6.6mA |
SG2 | 10.3mA |
SG3 | 17.5mA |
SG4 | 38.7mA |
SG5 | 42.0mA |
SG6 | 45.7mA |
SG7 | 49.2mA |
SG8(全开) | 52.5mA |
#include "Wire.h"
#include "M5UNIT_DIGI_CLOCK.h"
/* For M5Stack Basic */
#define SDA 21
#define SCL 22
#define ADD 0x30
/* For M5Atom Lite/Matrix */
// #define SDA 26
// #define SCL 32
// #define ADD 0x30
M5UNIT_DIGI_CLOCK Digiclock;
void setup()
{
delay(2000);
Serial.begin(115200);
Wire.begin(SDA, SCL);
/* Digital clock init */
if (Digiclock.begin(&Wire, SDA, SCL, ADD))
{
Serial.println("Digital clock init successful");
}
else
{
Serial.println("Digital clock init error");
while (1);
}
char buff[] = " ";
Digiclock.setString(buff);
delay(2000);
}
void loop()
{
char buff[] = "8.8.:8.8.";
Digiclock.setString(buff);
for (int i = 0; i < 5; i++)
{
Digiclock.setBrightness(9);
delay(150);
Digiclock.setBrightness(0);
delay(150);
}
delay(100);
for (int i = 0; i < 4; i++)
{
for (uint8_t i = 0; i < 9; i++)
{
Digiclock.setBrightness(i);
delay(20);
}
for (uint8_t i = 8; i > 0; i--)
{
Digiclock.setBrightness(i);
delay(20);
}
}
delay(100);
Digiclock.setBrightness(9);
for (int j = 0; j < 3; j++)
{
for (int i = 0; i < 10; i++)
{
sprintf(buff, "%d.%d.:%d.%d.", i, i, i, i);
Digiclock.setString(buff);
Serial.println(buff);
delay(200);
}
}
delay(100);
Digiclock.setBrightness(9);
for (;;)
{
char buff2[] = "12:00";
Digiclock.setString(buff2);
Serial.printf(buff2);
delay(1000);
char buff3[] = "1200";
Digiclock.setString(buff3);
Serial.printf(buff3);
delay(1000);
}
delay(100);
}