{"id":15932521,"url":"https://github.com/victornpb/multiplexed-7segments-display","last_synced_at":"2025-10-25T04:31:52.500Z","repository":{"id":23595913,"uuid":"26964581","full_name":"victornpb/multiplexed-7segments-display","owner":"victornpb","description":"Arduino sketch that provides multiplexing for a single or multiple 7 segments displays without extra hardware","archived":false,"fork":false,"pushed_at":"2019-09-07T19:42:15.000Z","size":11,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-09T03:26:28.324Z","etag":null,"topics":["7segment","arduino-library","arduino-sketch","cpp","multiplexer"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/victornpb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-21T15:06:56.000Z","updated_at":"2024-02-29T23:36:51.000Z","dependencies_parsed_at":"2022-08-22T03:10:51.837Z","dependency_job_id":null,"html_url":"https://github.com/victornpb/multiplexed-7segments-display","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victornpb%2Fmultiplexed-7segments-display","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victornpb%2Fmultiplexed-7segments-display/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victornpb%2Fmultiplexed-7segments-display/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/victornpb%2Fmultiplexed-7segments-display/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/victornpb","download_url":"https://codeload.github.com/victornpb/multiplexed-7segments-display/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247017955,"owners_count":20869922,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["7segment","arduino-library","arduino-sketch","cpp","multiplexer"],"created_at":"2024-10-07T02:02:15.683Z","updated_at":"2025-10-14T04:13:49.903Z","avatar_url":"https://github.com/victornpb.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ledDisp\nArduino sketch that provides multiplexing for a single or multiple 7 segments displays without extra hardware\n\n SevenSeg - 1.0\n \n created 20 August 2014\n by Victor N. Borges - www.vitim.us\n \n[![image](https://user-images.githubusercontent.com/3372598/58726174-8fc50200-83d0-11e9-88b7-c99d9a861c56.png)](https://www.youtube.com/watch?v=rRVRDSzHUmM)\n \n This arduino sketch provides software to drive 7-segments display with multiplexing.\n Only turns a single segment is turned on at time, this allows the display to be turned with just the pins current,\n and only requires a single resistor per display on the common pin.\n \n Displays are connected directly to the arduinos output pins, with one current limiting resistor on the common pin.\n For more than 1 display wire then in parallel, and connect the common pin to different I/O pins, so they can be selected.\n \n This code is assyncronous, and will block other pieces of code like using delay.\n \n call sevenSeg_setup() on your setup function, and call sevenSeg_displayHold(unsigned int us); inside the loop()\n the 'us' parameter is the interval between segments in microseconds, adjust this value depending on how long your\n whole program takes to execute.\n If you code alredy takes too much time to execute you can try to call sevenSeg_display() directly on your loop instead.\n \n# ledDisp\nArduino sketch that provides multiplexing for a single or multiple 7 segments displays without extra hardware\n\n SevenSeg - 1.0\n \n created 20 August 2014\n by Victor N. Borges - www.vitim.us\n \n This arduino sketch provides software to drive 7-segments display with multiplexing.\n Only turns a single segment is turned on at time, this allows the display to be turned with just the pins current,\n and only requires a single resistor per display on the common pin.\n \n Displays are connected directly to the arduinos output pins, with one current limiting resistor on the common pin.\n For more than 1 display wire then in parallel, and connect the common pin to different I/O pins, so they can be selected.\n \n This code is assyncronous, and will block other pieces of code like using delay.\n \n call sevenSeg_setup() on your setup function, and call sevenSeg_displayHold(unsigned int us); inside the loop()\n the 'us' parameter is the interval between segments in microseconds, adjust this value depending on how long your\n whole program takes to execute.\n If you code alredy takes too much time to execute you can try to call sevenSeg_display() directly on your loop instead.\n\n## Setup the code\n\n### Constants\n \n - `const uint8_t displayCount`  \n Number of displays\n\n- `const uint8_t displayCommonPins[]`  \n Pin name which the display common are connected.  \n eg: const uint8_t displayCommonPins[2] = {A2, A3};\n\n- `const uint8_t displayPins[8]`  \n  Array containing the 8 pins of the displays.  \n  {A, B, C, D, E, F, G, POINT}  \n  e.g: {11, 10, 8, 7, 6, 12, A0, 9}\n\n### Type of Display\nChange settings to match Common Cathode/Anode  \n```\n#define SEGMENT_ON HIGH\n#define COMMON_ON LOW\n```\n\n# Usage\n\n## Initialization\n\n- `void sevenSeg_setup()`  \n Call this on setup to set all pinsMode's\n\n## Drive the Segments\n\n- `void sevenSeg_displayHold(unsigned int us)`  \n  Function that perform the multiplexing to draw every digit with a assyncronous delay between segments.  \n  IMPORTANT: This should be called on your main loop repeatedly. But you cannot have code that blocks the main loop. E.G. delay.  \n  \n  Parameters:  \n    - unsigned int **us**: adjust the interval between segments in microseconds.  This is used to adjust the scan rate (refresh rate per segment).\n  \n  Note: if your program is very busy, you can try to call sevenSeg_display() directly instead, in order to archive faster scan rates.\n\n# ---\n\n## Font\n\n  A character is represented by a single byte. You can define your own charactes, in a font-like array, which every position of the array contains a bitmap of a diferent character.\n  \n  The code is provided with a set of numbers and optional letters that can be toggled using a macro.\n  \n  You can also create your own set using this tool: https://github.com/victornpb/7segments\n  \n```  \n#define ALPHA 0 //change to 1 to include leters \n\nconst byte sevenSeg_font[] = {\n    B11111100,  // 0\n    B01100000,  // 1\n    B11011010,  // 2\n    B11110010,  // 3\n    B01100110,  // 4\n    B10110110,  // 5\n    B10111110,  // 6\n    B11100000,  // 7\n    B11111110,  // 8\n    B11110110,  // 9\n    B00000010, // dash -\n    B00010000, // underscore _\n  #if ALPHA==1\n    B11101110, //A\n    B00111110, //b\n    B10011100, //C\n    B00011010, //c\n    B01111010, //d\n    B10011110, //E\n    B10001110, //F\n    B01101110, //H\n    B00101110, //h\n    B00011100, //L\n    B01100000, //l\n    B11111100, //O\n    B00111010, //o\n    B11001110, //P\n    B10110110, //S\n  #endif\n    B00000000,  // blank\n};\n```\n \n## Writing data on the displays\n\n- `void sevenSeg_setDigit(uint8_t digit, byte character)`  \n  Set a display digit  \n  \n  Parameters:  \n   - uint8_t digit - Display Index\n   - byte character - 7bit 0 paded character\n   \n  Usage:  \n   \u003e sevenSeg_setDigit(**\u003cdisplay numeber\u003e**, **sevenSeg_font[\u003ccharacterIndex\u003e]**)  \n   \u003e e.g.: `sevenSeg_setDigit(0, sevenSeg_font[0]);`  \n   \u003e Will display `0` on the first display\n\n- `void sevenSeg_setDecimalPoint(uint8_t digit, bool on)`  \n  Toggle the decimal point on/off  \n  \n  Parameters:  \n   - uint8_t digit - Display Index\n   - bool on - state true/false\n\n\n----\n\n#### Global Variables\n\n  Those variables are not intended to be changed by your code.\n\n - `byte displayData[2];`  \n  *buffer* of the data being pushed to each display.\n  Size of the array must be the same as *displayCount*\n\n - `byte currentSegment;` (private)  \n  keep state of the current segment being in the driven\n\n - `byte currentDigit;` (private)  \n  keep state of the current segment being driven\n\n - `long previousMicros` (private)  \n  keep state of interval between segments\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictornpb%2Fmultiplexed-7segments-display","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvictornpb%2Fmultiplexed-7segments-display","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvictornpb%2Fmultiplexed-7segments-display/lists"}