Difference between revisions of "4-Digital Display"
(→Liens internes) |
(→Librairies) |
||
| Line 17: | Line 17: | ||
==== Librairies ==== | ==== Librairies ==== | ||
[http://https://code.google.com/p/arduino-timerone/downloads/detail?name=TimerOne-v9.zip TimerOne library]<br> | [http://https://code.google.com/p/arduino-timerone/downloads/detail?name=TimerOne-v9.zip TimerOne library]<br> | ||
| − | + | ||
| + | https://github.com/Seeed-Studio/Grove_4Digital_Display<br> | ||
| + | |||
[http://https://github.com/Seeed-Studio/Four_Digit_Display_Suli Four-Digit Display Suli Library] | [http://https://github.com/Seeed-Studio/Four_Digit_Display_Suli Four-Digit Display Suli Library] | ||
Revision as of 22:46, 29 May 2025
Contents
Grove - 4-Digital Displays (Seeed-Studio)
Caractéristiques
Grove compatible interface (3.3V/5V)
connect to D2/D3
4 digit red alpha-numeric display
8 adjustable luminance levels
Support
Drivers
chip - TM1637
Librairies
https://github.com/Seeed-Studio/Grove_4Digital_Display
Four-Digit Display Suli Library
Voltage
3.3V ~ 5.5V
Code Exemple->DigitalTube->ClockDisplay
Copier les deux librairies dans C:\Program Files (x86)\Arduino\libraries, exécuter Arduino IDE, chercher l'exemple, choisir Arduino UNO, et le port COM
// Author:Frankie.Chu
// Date:9 April,2012
#include <TimerOne.h>
#include "TM1637.h"
#define ON 1
#define OFF 0
int8_t TimeDisp[] = {0x00,0x00,0x00,0x00};
unsigned char ClockPoint = 1;
unsigned char Update;
unsigned char halfsecond = 0;
unsigned char second;
unsigned char minute = 0;
unsigned char hour = 12;
#define CLK 2//pins definitions for TM1637 and can be changed to other ports
#define DIO 3
TM1637 tm1637(CLK,DIO);
void setup()
{
tm1637.set();
tm1637.init();
Timer1.initialize(500000);//timing for 500ms
Timer1.attachInterrupt(TimingISR);//declare the interrupt serve routine:TimingISR
}
void loop()
{
if(Update == ON)
{
TimeUpdate();
tm1637.display(TimeDisp);
}
}
void TimingISR()
{
halfsecond ++;
Update = ON;
if(halfsecond == 2){
second ++;
if(second == 60)
{
minute ++;
if(minute == 60)
{
hour ++;
if(hour == 24)hour = 0;
minute = 0;
}
second = 0;
}
halfsecond = 0;
}
// Serial.println(second);
ClockPoint = (~ClockPoint) & 0x01;
}
void TimeUpdate(void)
{
if(ClockPoint)tm1637.point(POINT_ON);
else tm1637.point(POINT_OFF);
TimeDisp[0] = hour / 10;
TimeDisp[1] = hour % 10;
TimeDisp[2] = minute / 10;
TimeDisp[3] = minute % 10;
Update = OFF;
}
il affiche 02:21 et ensuite il modifié le 1er digit à un intervalle regulier