⭐ Star us on GitHub — it helps!
Arduino Library for STLED316S LED controller with keyscan
Link to STLED316S product page
- Adjustment of the correspondence between the driver outputs and the display segments
- Drive individualy each Digit LED display
- Drive individualy each LED output
- Display of raw data, decimal number or hexadecimal number
- Brightness adjustment of each digit and LED
- Keyscan reading (possibility on interruption)
- (option) Hardware SPI (Reading the registers of the STLED316S is not possible using the hardware SPI. In this mode it is not possible to read the status of the Keyscan)
- Version 1.0.0 -- Intial version
- Version 1.0.1 -- Addition of a private variable to save the state of the LEDs.
- Version 1.0.2 -- Fix vtable linker error
- Version 1.0.3 :
- Modify default correspondence between the driver outputs and the display segments (STLED316S Display Board compatibility)
- Add an example of using the keys interrupt
- Version 1.1.0 :
- Add display float function
- Add display signed decimal function
- Add keyscan read function
- Arduino Uno (5V) : Tested
- Arduino Mega (5V) : Tested
- Arduino Due : Not tested
- STM32 : Not tested
- ESP8266 : Not tested
- ESP32 : Not tested
- ...
STLED316S Display Board :
See the electronic diagram available in the 'extras' directory.Download STLED316S from this Github repository, un-zip or extract the files and place the STLED316S directory in your .../Arduino/libraries/... folder. The .../Arduino/... folder is the one where your Arduino IDE sketches are usually located.
Include the STLED316S.h file at the beginning of your sketch:
#include <STLED316S.h>The object should be created with only the parameters:
- Number of digit
- STB pin (chip select)
- Clock pin
- DIN/DOUT pin
Example:
#define NBR_OF_DIGIT 2
#define STB_PIN 8
#define CLK_PIN 13
#define DATA_PIN 11
STLED316S stled(NBR_OF_DIGIT, STB_PIN, CLK_PIN, DATA_PIN);To initialise the STLED316S it is necessary to call the begin() function.
Without parameters (digA = SEG1, digB = SEG2, digC = SEG3 ...) :
stled.begin();With parameters -> Adjustment of the correspondence between the driver outputs and the display segments: begin(uint8_t digA, uint8_t digB, uint8_t digC, uint8_t digD, uint8_t digE, uint8_t digF, uint8_t digG, uint8_t digDP) with :
- digA : Output pin of STLED316S for segment a
- digB : Output pin of STLED316S for segment b
- digC : Output pin of STLED316S for segment c
- digD : Output pin of STLED316S for segment d
- digE : Output pin of STLED316S for segment e
- digF : Output pin of STLED316S for segment f
- digG : Output pin of STLED316S for segment g
- digDP : Output pin of STLED316S for segment DP Values : (STLED316S outputs) SEG1, SEG2, SEG3, SEG4, SEG5, SEG6, SEG7 or SEG8
Example:
stled.begin(SEG1, SEG2, SEG3, SEG4, SEG5, SEG6, SEG7, SEG8);- STLED316S_display.ino : Control LED and digit
- STLED316S_keyscan.ino : Reading the keyscan status with polling
- STLED316S_keys_interrupt.ino : Reading the keyscan status on interruption
- STLED316S_spi.ino : Using hardware SPI
You can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
