{"id":13893962,"url":"https://github.com/RobTillaart/HT16K33","last_synced_at":"2025-07-17T08:31:44.107Z","repository":{"id":45346139,"uuid":"271968147","full_name":"RobTillaart/HT16K33","owner":"RobTillaart","description":"Arduino Library for HT16K33 4x7segment display","archived":false,"fork":false,"pushed_at":"2024-04-13T09:03:57.000Z","size":77,"stargazers_count":24,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-19T06:33:41.241Z","etag":null,"topics":["7segment","arduino","display"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RobTillaart.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"RobTillaart","custom":"https://www.paypal.me/robtillaart"}},"created_at":"2020-06-13T08:14:49.000Z","updated_at":"2024-11-11T09:55:11.000Z","dependencies_parsed_at":"2024-01-04T16:48:34.569Z","dependency_job_id":"3709fe53-2c35-4c2f-bf51-3256565088b4","html_url":"https://github.com/RobTillaart/HT16K33","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FHT16K33","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FHT16K33/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FHT16K33/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FHT16K33/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RobTillaart","download_url":"https://codeload.github.com/RobTillaart/HT16K33/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226243893,"owners_count":17594452,"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","display"],"created_at":"2024-08-06T18:01:20.794Z","updated_at":"2024-11-24T22:31:02.028Z","avatar_url":"https://github.com/RobTillaart.png","language":"C++","funding_links":["https://github.com/sponsors/RobTillaart","https://www.paypal.me/robtillaart"],"categories":["C++"],"sub_categories":[],"readme":"\n[![Arduino CI](https://github.com/RobTillaart/HT16K33/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)\n[![Arduino-lint](https://github.com/RobTillaart/HT16K33/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/HT16K33/actions/workflows/arduino-lint.yml)\n[![JSON check](https://github.com/RobTillaart/HT16K33/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/HT16K33/actions/workflows/jsoncheck.yml)\n[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/HT16K33.svg)](https://github.com/RobTillaart/HT16K33/issues)\n\n[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/HT16K33/blob/master/LICENSE)\n[![GitHub release](https://img.shields.io/github/release/RobTillaart/HT16K33.svg?maxAge=3600)](https://github.com/RobTillaart/HT16K33/releases)\n[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/HT16K33.svg)](https://registry.platformio.org/libraries/robtillaart/HT16K33)\n\n\n# HT16K33\n\nArduino Library for HT16K33 I2C 4x7segment display.\n\n\n## Description\n\nThis library is for the Adafruit 4x7segment display with HT16K33 driver,\nhttp://www.adafruit.com/products/1002\n\nThis library is functionally less capable than Adafruits. \nHowever as it caches the values written to the display per position \nit is faster for writing on average. The actual gain depends on the\napplication and of course the values. \n\n\n#### 0.4.0 Breaking change\n\nVersion 0.4.0 introduced a breaking change.\nYou cannot set the pins in **begin()** any more.\nThis reduces the dependency of processor dependent Wire implementations.\nThe user has to call **Wire.begin()** and can optionally set the Wire pins \nbefore calling **begin()**.\n\n\n## Performance \n\nVersion 0.3.0 allows one to switch the caching on/off to enforce\nwriting all positions e.g. in case of noisy I2C bus. \n\nThe example **demo_cache.ino** measures the performance gain of caching \nfor different I2C bus speeds. \n\n```\nTest on UNO, I2C.setClock(100000);  // version 0.1.2\n0-9999 integers       3.960 sec\n0-65535 hexadecimal  23.685 sec\n\nTest on UNO, I2C.setClock(800000);  // version 0.1.2\n0-9999 integers       1.223 sec\n0-65535 hexadecimal   6.350 sec\n\nTest on UNO, I2C.setClock(100000);  // version 0.3.0\n0-9999 integers       4.092 sec     // ~3% slower due to robustness \u0026 cache control \n0-65535 hexadecimal  24.336 sec\n```\n\n\n## Multiple display \n\nThe library supports only one display. Using multiple displays (cascading) e.g. to\ndisplay more than 4 digits must done by the user - see **demo_dual1.ino**. \nWith dual display it is important to **setDigits()** for the displays correctly to\nget leading/trailing zero's correctly.\n\n\n## Interface\n\n```cpp\n#include \"HT16K33.h\"\n```\n\n#### Setup behaviour\n\n- **HT16K33(const uint8_t address)** address is 0x70..0x77 depending on the jumpers A0..A2. **0x70** is default.\n- **bool begin()** initialize library and calls **reset()**.\nReturns false if address not seen on I2C bus.\n- **bool isConnected()** Returns false if address not seen on I2C bus.\n- **void reset()** resets display.\n\n#### Cache\n\n- **void clearCache()** forced clearing of the cache, to be used to switch the cache off just for one write.\n- **void cacheOn()** enable caching, this is default behaviour.\n- **void cacheOff()** disable caching, will force writing to every position.\n\n#### Display\n\n- **void displayOn()** enable display.\n- **void displayOff()** disable display, fast way to darken display e.g. for energy consumption.\n- **void setBrightness(uint8_t value)** values (dim) 0..15 (bright).\n- **void getBrightness()** returns (dim) 0..15 (bright).\n- **void setBlink(uint8_t value)** values 0..3   0 = off.\n- **void getBlink(uint8_t value)** values 0..3   0 = off.\n- **void setDigits(uint8_t value)** values 0..4, minimal number of digits shown, mandatory for large numbers on dual display.\n\n#### Data types\n\nThe bool return value indicates that the value displayed is in range.\n\n- **void displayClear()** fill display with spaces =\u003e results in an empty display.\n- **bool displayInt(int n)** values -999 .. 9999\n- **bool displayHex(uint16_t n)** values 0000 .. FFFF\n- **bool displayDate(uint8_t left, uint8_t right, bool lz = true)** values 00.00..99.99 Date could be {month.day} or {day.hour}  \nIt uses **.** as separator. Optional the leading zero (lz) \ncan be replaced by a space to look more natural e.g 1:54  instead of  01:54\n- **bool displayTime(uint8_t left, uint8_t right, bool colon = true, bool lz = true)** values 00:00..99:99 \nTime could be hh:mm or mm:ss or ss:uu (hundreds), it uses **:** as separator. \nOptional the colon is set to false (e.g. to simulate blink) and optional the leading zero (lz) \ncan be replaced by a space to look more natural e.g 1:54  instead of  01:54\n- **void displaySeconds(uint16_t seconds, bool colon, bool lz = true)** displays 00:00..99:99 units in seconds (or minutes) - splits % 60 : as separator\nOptional the colon is set to false (to simulate blink). \nOptional the leading zero (lz) can be replaced by a space to look more natural e.g 1:54  instead of 01:54\n- **bool displayFloat(float f, uint8_t decimals = 3)** values -999..0.000..9999\nThe number of decimals = 0,1,2,3 = default. When less decimals are displayed, the number will be right aligned.\n- **bool displayUnit(float f, uint8_t decimals = 2, uint8_t unitChar = HT16K33_SPACE)** values -99..0.000..999\nThe number of decimals = 0,1,2 = default. When less decimals are displayed, the number will be right aligned.\nThe unitChar is a postFix character like C or F for temperature H for humidity. \nThe unitChar must be one of the chars supported like HT16K33_C, HT16K33_TOP_C or HT16K33_DEGREE (see below).\nSo **displayUnit(25.6, 1, HT16K33_DEGREE)** will display **23.5°**.\n\n#### Fixed point\n\n- **bool displayFixedPoint0(float f)** displays values -999  .. 9999 without decimals.\n- **bool displayFixedPoint1(float f)** displays values -99.9 .. 999.9 with 1 decimals.\n- **bool displayFixedPoint2(float f)** displays values -9.99 .. 99.99 with 2 decimals.\n- **bool displayFixedPoint3(float f)** displays values 0.000 .. 9.999 with 3 decimals.\n\n#### Special VU meters\n\n- **bool displayVULeft(uint8_t value)** display used as sort VU meter, values 0..8  Vales \u003e 8 are treated as 8 (but return false).\n- **bool displayVURight(uint8_t value)** display used as sort VU meter, values 0..8 Vales \u003e 8 are treated as 8 (but return false).\n\n#### Lower level workers\n\n- **void display(uint8_t \\* array)** array of 4 bytes to control one 7seg display.\n- **void display(uint8_t \\* array, uint8_t point)** idem + point = position of the digit with point (0..3).\n- **void displayColon(uint8_t on)** 0 = off, all values other are on.\n- **void displayRaw(uint8_t \\* array, bool colon)** array of 4 bytes to control one 7seg display + colon flag.\n- **void displayExtraLeds(uint8_t value)** switch on extra LEDs.\nvalue is in fact a bit mask see table below. 0 = all off.\n\nWhen using the consts SEG_A etc from .h file, for the **displayRaw()**\none can use the individual segments SEG_A..SEG_G and SEG_DP.\n\n![layout](https://upload.wikimedia.org/wikipedia/commons/0/02/7_segment_display_labeled.svg \"\").\n\n_Image courtesey wikimedia_\n\n\n#### Extra LEDs table\n\n|  mask  |  description  |\n|:------:|:--------------|\n|  0x00  |  all off \n|  0x02  |  colon.\n|  0x04  |  upper left point, left of the 1st digit.\n|  0x08  |  lower left point, left of the 1st digit.\n|  0x10  |  upper point between 3rd and 4th digit.\n\n( based upon issue #21 )\n\n\n#### Debugging\n\n- **void displayTest(uint8_t del)** debugging / test function.\n- **void dumpSerial(uint8_t \\* array, uint8_t point)** debugging equivalent of the display.\nPrints to Serial.\n- **void dumpSerial()** print HEX codes equivalent of the display to Serial.\n- **uint8_t getAddress()** idem.\n\n\n#### Obsolete soon\n\n- brightness() use setBrightness()\n- blink() use setBlink()\n\n\n## Characters supported\n\nfrom .h file, elaborate\n\n```cpp\n#define HT16K33_0                0\n#define HT16K33_1                1\n#define HT16K33_2                2\n#define HT16K33_3                3\n#define HT16K33_4                4\n#define HT16K33_5                5\n#define HT16K33_6                6\n#define HT16K33_7                7\n#define HT16K33_8                8\n#define HT16K33_9                9\n#define HT16K33_A                10\n#define HT16K33_B                11\n#define HT16K33_C                12\n#define HT16K33_D                13\n#define HT16K33_E                14\n#define HT16K33_F                15\n#define HT16K33_SPACE            16\n#define HT16K33_MINUS            17\n#define HT16K33_TOP_C            18     //  c\n#define HT16K33_DEGREE           19     //  °\n#define HT16K33_NONE             99\n```\n\nIf other chars are needed please file an issue.\n\n\n## Operation\n\nSee examples\n\n\n## Future\n\n\n#### Must\n\nMainly for a 0.4.x\n\n- **bool isDisplayOn()** and similar state functions\n  - configuration byte: 4 bits brightness, 1 bit on off flag, 1 bit cache flag, 2 blink rate\n\n#### Should \n\n\n#### Could\n\n- VU metering using halve bars allows two VU from 0..8   **new**\n- VU metering using halve bars allows one VU from 0..17. extension of current VUleft/right\n- optimize math if possible - performance and footprint. + float + int division\n- low level I2C error detection\n- write single position - **writePos(uint8_t pos, uint8_t mask)**\n  - [status] dd.d\n- add examples\n  - car battery monitor (voltage divider \u0026 analogRead)\n- add more \"special chars\"?\n  - #define HT16K33_P  Pascal / Pressure   0x73\n  - #define HT16K33_J  joule               0x0E\n  - #define HT16K33_H  humidity            0x76\n\n\n#### Wont (unless sponsored)\n\n- **rotate(bool rot = false)**\n  - 180 degree rotation of all digits for mounting  \n  - reverse digit order\n  - flip every digit (function to overwrite the char array)\n- **HUD(bool hud = false)** = Heads Up Display\n  - flip every digit\n- **lastTime()** in millis  too much overhead.\n- add special chars to keywords?  nope\n- **readCache(int n)** access internal cache =\u003e dumpSerial()\n\n\n## Support\n\nIf you appreciate my libraries, you can support the development and maintenance.\nImprove the quality of the libraries by providing issues and Pull Requests, or\ndonate through PayPal or GitHub sponsors.\n\nThank you,\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRobTillaart%2FHT16K33","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRobTillaart%2FHT16K33","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRobTillaart%2FHT16K33/lists"}