Author Topic: Good seven segment Arduino library?  (Read 2071 times)

0 Members and 1 Guest are viewing this topic.

Offline don.rTopic starter

  • Frequent Contributor
  • **
  • Posts: 740
  • Country: ca
Good seven segment Arduino library?
« on: September 13, 2017, 03:22:10 am »
I have a project that re-purposes a front panel with a 4 digit 7 segment display, some buttons and some separate LEDs. The buttons are poled on each digit pass (3 buttons per digit) and the LEDs are wired as "segments" to a separate "digit". I was using SevenSeg V1.2.1 by Sigvald Marholm and its workable with modifications but a little constricted. I was wondering if there was something a bit more flexible out there. My Arduino is a Nano 168 but I may be stepping up to something... ahem... bigger in the near future  :D
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4040
  • Country: nz
Re: Good seven segment Arduino library?
« Reply #1 on: September 13, 2017, 06:58:53 am »
I had a quick look. Seems pretty flexible to me. Set the segment pins. Set the digit pins. Set common cathode or common anode. Set active hi or active lo. Functions to set individual digits, or convert a number to decimal (I didn't check if it is recursive). Functions to set the refresh rate and duty cycle.

What more do you want, exactly?

You can always write your own. Converting a 4 bit decimal/BCD value to 7 bits for the segments is trivial -- all you need is a constant array containing seven "short"s (or ints on Arduino) and AND each one with 1<<digit_value and light that segment if the result is nonzero. Or use an array of 10 (or 16) chars. Whatever.
 

Offline don.rTopic starter

  • Frequent Contributor
  • **
  • Posts: 740
  • Country: ca
Re: Good seven segment Arduino library?
« Reply #2 on: September 13, 2017, 02:26:09 pm »
Its pretty good, I was just wondering if there was a better one I was missing. I need to control the individual LEDs separately but multiple displays is not supported while using timer interrupts which I need for the button poling. However, after thinking about it, it would be easier to modify this library rather than find another one.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf