DL34 (SIEMENS)


Připojení k Arduinu

Pin DL34Název pinu DL34Pin Arduino
1–
2E6
3D5
4C4
5DP1
6G8
7CATHODE 412 (přes odpor 220ohm)
8–
9B3
10CATHODE 311 (přes odpor 220ohm)
11F7
12CATHODE 210 (přes odpor 220ohm)
13A2
14CATHODE 19 (přes odpor 220ohm)

Zdrojový kód pro Arduino

#include "SevSeg.h"

SevSeg sevseg; 

byte numDigits = 4;
byte digitPins[] = {9, 10, 11, 12};
byte segmentPins[] =  {2, 3, 4, 5, 6, 7, 8, A0};
bool resistorsOnSegments = false; 
byte hardwareConfig = COMMON_CATHODE; 
bool updateWithDelays = false; 
bool leadingZeros = true; 

void setup() {
  sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments, updateWithDelays, leadingZeros);
  sevseg.setBrightness(90);
}

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();
}


Demo video


Leave a Reply