โมดูลแสดงค่าตัวเลข 4 หลัก จุดนาฬิกา 0.56" TM1637 Driver สีแดง 7 segment module
โมดูลแสดงผลตัวเลข ใช้ไอซีไดรเวอร์เบอร์ TM1637 โมดูลแสดง 7 Segment ตัวเลข 4 หลักพร้อมจุดทศนิยม และ จุดนาฬิกา ขนาดหน้าจอ 0.56 นิ้ว ใช้สายสัญญาณเพียง 2 เส้น สามารถปรับความสว่าง เปิด/ปิด หน้าจอได้ ใช้ไฟเลี้ยง 3.3-5V
Library โมดูลแสดงค่าตัวเลข 4 หลัก TM1637
วิธีการต่อ โมดูลแสดงค่าตัวเลข 4 หลัก TM1637
- VIN - 5V
- GND - GND
- CLK - A4
- DIO - A5
ตัวอย่างโค๊ด GY-530 VL53L0X
2
// This library is free software; you can redistribute it and/or
3
// modify it under the terms of the GNU Lesser General Public
4
// License as published by the Free Software Foundation; either
5
// version 2.1 of the License, or (at your option) any later version.
7
// This library is distributed in the hope that it will be useful,
8
// but WITHOUT ANY WARRANTY; without even the implied warranty of
9
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10
// Lesser General Public License for more details.
12
// You should have received a copy of the GNU Lesser General Public
13
// License along with this library; if not, write to the Free Software
14
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16
#define CLK A4//pins definitions for TM1637 and can be changed to other ports
18
TM1637 tm1637(CLK,DIO);
23
tm1637.set(BRIGHT_TYPICAL);//BRIGHT_TYPICAL = 2,BRIGHT_DARKEST = 0,BRIGHTEST = 7;
29
int8_t NumTab[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};//0~9,A,b,C,d,E,F
32
unsigned char count = 0;
38
if(count == sizeof(NumTab)) count = 0;
39
for(unsigned char BitSelect = 0;BitSelect < 4;BitSelect ++)
41
ListDisp[BitSelect] = NumTab[i];
43
if(i == sizeof(NumTab)) i = 0;
45
tm1637.display(0,ListDisp[0]);
46
tm1637.display(1,ListDisp[1]);
47
tm1637.display(2,ListDisp[2]);
48
tm1637.display(3,ListDisp[3]);