0

The SevSeg library by Dean Reading seems to have a keyword to control individual segments on SSD's. I am using four common cathode, single digit displays. Does anyone know how to program individual segments?

#include "SevSeg.h"; 

SevSeg sevseg; 

void setup() {
  // put your setup code here, to run once:

  byte numDigits = 4;
  byte digitPins[] = {2, 3, 4, 5};
  byte segmentPins[] = {6, 7, 8, 9, 10, 11, 12, 13};
  bool resistorsOnSegments = false; // 'false' means resistors are on digit pins
  byte hardwareConfig = COMMON_CATHODE; // See README.md for options
  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() {
  // put your main code here, to run repeatedly:

  sevseg.setSegments();
  //sevseg.setNumber(1234,0);
  //sevseg.setChars("");
  //sevseg.blank();
  sevseg.refreshDisplay();

}
5
  • why did you not put a parameter into the setSegments() function call?
    – jsotola
    Commented Jan 17, 2020 at 22:14
  • Because i don't yet know what parameter to put, or how to use the function.
    – BobaJFET
    Commented Jan 17, 2020 at 22:15
  • tried that. displays a bunch of gibberish.
    – BobaJFET
    Commented Jan 17, 2020 at 22:20
  • It is always the same if you just enter 1, or 2, or 25 etc.. I don't think that's how the function works. Displaying numbers with the setNumber function works perfectly however, so my displays are wired correctly.
    – BobaJFET
    Commented Jan 17, 2020 at 22:24
  • what is unclear here github.com/DeanIsMe/SevSeg/blob/…
    – Juraj
    Commented Jan 18, 2020 at 19:17

1 Answer 1

0

You can't with that library. The author has not provided any public methods that will do the job.

There are private methods (segmentOn and segmentOff) that might be usable, but you would have to modify the library to be able to access them.

9
  • Are 4 and 2 just arbitrary numbers you chose?
    – BobaJFET
    Commented Jan 17, 2020 at 22:19
  • Yes. They are the segment number you want to turn on or off.
    – Majenko
    Commented Jan 17, 2020 at 22:25
  • How would you specify which digit?
    – BobaJFET
    Commented Jan 17, 2020 at 22:31
  • Probably with different numbers. Experiment and find out.
    – Majenko
    Commented Jan 17, 2020 at 22:43
  • Last question.. Where should those functions be placed within the code? I'm getting "private within this context".
    – BobaJFET
    Commented Jan 17, 2020 at 23:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.