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();
}
1 Answer 1
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.
-
Are 4 and 2 just arbitrary numbers you chose?BobaJFET– BobaJFET2020年01月17日 22:19:52 +00:00Commented Jan 17, 2020 at 22:19
-
Yes. They are the segment number you want to turn on or off.Majenko– Majenko2020年01月17日 22:25:04 +00:00Commented Jan 17, 2020 at 22:25
-
How would you specify which digit?BobaJFET– BobaJFET2020年01月17日 22:31:55 +00:00Commented Jan 17, 2020 at 22:31
-
Probably with different numbers. Experiment and find out.Majenko– Majenko2020年01月17日 22:43:01 +00:00Commented 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– BobaJFET2020年01月17日 23:03:25 +00:00Commented Jan 17, 2020 at 23:03
setSegments()
function call?