/*
  Franzininho WiFi Seven Segment Counter Example

  @important: I had a problem with pins greater than 26,
              probably some limitation in the SevSeg library.
*/

#include "SevSeg.h"

SevSeg sevseg;

void setup() {
  byte numDigits = 4;
  byte digitPins[] = {6, 18, 21, 0};
  byte segmentPins[] = {7, 26, 2, 4, 5, 8, 1, 3};
  bool resistorsOnSegments = false;   // 'false' means resistors are on digit pins
  byte hardwareConfig = COMMON_ANODE; // COMMON_ANODE or COMMON_CATHODE
  bool updateWithDelays = false;      // Default 'false' is recommended
  bool leadingZeros = false;          // Use 'true' if you'd like to keep the leading zeros
  bool disableDecPoint = false;       // Use 'true' if your decimal point doesn't exist or isn't connected. Then, you only need to specify 7 segmentPins[]

  sevseg.begin(hardwareConfig, numDigits, digitPins, segmentPins, resistorsOnSegments,
               updateWithDelays, leadingZeros, disableDecPoint);
}

void loop() {
  sevseg.setNumber(millis() / 250);
  sevseg.refreshDisplay();
  delay(1); // This speeds up the simulation
}
Loading
franzininho-wifi