Připojení k Arduinu
Pro připojení anod vždy používejte předřadný odpor, jinak dojde ke zničení displeje!
Kalkulátor zde: https://www.ctvrtky.info/wp-content/uploads/2025/07/LED-resistor-calculation.html
| Pin DL440 | Název pinu DL440 | Pin Arduino |
|---|---|---|
| 1 | – | – |
| 2 | E | D6 |
| 3 | D | D5 |
| 4 | – | – |
| 5 | C | D4 |
| 6 | DP | A0 |
| 7 | CATHODE 2 | D10 |
| 8 | B | D3 |
| 9 | G | D8 |
| 10 | A | D2 |
| 11 | F | D7 |
| 12 | CATHODE 1 | D9 |
Zdrojový kód pro Arduino
#include "SevSeg.h"
SevSeg sevseg;
byte numDigits = 2; //Change number of digits by type
byte digitPins[] = {9, 10};//Change number of pins by type
byte segmentPins[] = {2, 3, 4, 5, 6, 7, 8, A0};
bool resistorsOnSegments = true;
byte hardwareConfig = COMMON_CATHODE;
bool updateWithDelays = false;
bool leadingZeros = true;
void setup() {
sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments, updateWithDelays, leadingZeros);
sevseg.setBrightness(100);
delay(2000);
}
void loop() {
static unsigned long timer = millis();
static int deciSeconds = 0;
static byte deciPoint = 0;
if (millis() - timer >= 300) {
timer += 300;
deciSeconds++;
deciPoint++;
if (deciPoint == numDigits) {
deciPoint = 0;
}
if (deciSeconds == pow(10, numDigits)) {
deciSeconds = 0;
}
sevseg.setNumber(deciSeconds, deciPoint);
}
sevseg.refreshDisplay();
}