nanoFramework.Iot.Device.Tm1637
1.0.277-preview.1
Prefix Reserved
See the version list below for details.
dotnet add package nanoFramework.Iot.Device.Tm1637 --version 1.0.277-preview.1
NuGet\Install-Package nanoFramework.Iot.Device.Tm1637 -Version 1.0.277-preview.1
<PackageReference Include="nanoFramework.Iot.Device.Tm1637" Version="1.0.277-preview.1" />
paket add nanoFramework.Iot.Device.Tm1637 --version 1.0.277-preview.1
#r "nuget: nanoFramework.Iot.Device.Tm1637, 1.0.277-preview.1"
// Install nanoFramework.Iot.Device.Tm1637 as a Cake Addin
#addin nuget:?package=nanoFramework.Iot.Device.Tm1637&version=1.0.277-preview.1&prerelease
// Install nanoFramework.Iot.Device.Tm1637 as a Cake Tool
#tool nuget:?package=nanoFramework.Iot.Device.Tm1637&version=1.0.277-preview.1&prerelease
TM1637 - Segment Display
TM1637 is a segments display with 6 characters Led controler. It uses a 2 wire implementation, one for the clock (CLK), one for the data (DIO). This chip can act as well as a key reader. This part has not been implemented. Only the Led display has been implemented. Most of its modern usages are for 4 to 6 segment displays.
Documentation
- TM1637 datasheet
Device family
You can find this display as Grove elements as well as very cheap with no brand. A search on your favorite online shop will give you lots of options. Those simple displays are used a lot for simple clock for example.
Testing was performed with a HiLetgo part.
Usage
You need to create a Tm1637
class with 2 pins, the clock one and the data one.
Tm1637 tm1637 = new Tm1637(4, 0);
Screen on, off, brightness
It is possible and you have to turn the screen on when you want to use the Tm1637.
tm1637.Brightness = 7;
tm1637.ScreenOn = true;
tm1637.ClearDisplay();
As an example, this will blink the screen:
for (int i = 0; i < 10; i++)
{
tm1637.ScreenOn = !tm1637.ScreenOn;
tm1637.Display(rawData);
Thread.Sleep(500);
}
When adjusting the screen brightness from 0 to 7 where 7 is the maximum, the command is immediate.
You can clear the display as well:
tm1637.ClearDisplay();
Displaying pre build characters
Characters are prebuild from 0 to F to facilitate hexadecimal displays on the segments. The following example will display the number 4 then 2 with a dot then A and F.
Character[] toDisplay = new Character[4] {
Character.Digit4,
Character.Digit2 | Character.Dot,
Character.Digit3,
Character.Digit8
};
tm1637.Display(toDisplay);
The maximum size of the buffer is 6.
Displaying raw data
You can as well display raw data like in the following example:
// Displays couple of raw data
Character[] rawData = new Character[6] {
// All led on including the dot
(Character)0b1111_1111,
// All led off
(Character)0b0000_0000,
// top blanck, right on, turning like this including dot
(Character)0b1010_1010,
// top on, right black, turning like this no dot
(Character)0b0101_0101,
// half one half off
Character.SegmentTop | Character.SegmentTopRight | Character.SegmentBottomRight | Character.SegmentBottom,
// half off half on
Character.SegmentTopLeft|Character.SegmentBottomLeft|Character.SegmentMiddle | Character.Dot,
};
// If you have a 4 display, only the first 4 will be displayed
// on a 6 segment one, all 6 will be displayed
tm1637.Display(rawData);
The maximum size of the buffer is 6.
Segment order
You can change the order of the characters. In some cases, especially when you have displays with 6 segments split with 2 displays of 3, the order may not be the one you expect.
tm1637.CharacterOrder = new byte[] { 2, 1, 0, 5, 4, 3 };
Make sure you have a length of 6 and all numbers from 0 to 5.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net is compatible. |
-
- nanoFramework.CoreLibrary (>= 1.11.7)
- nanoFramework.Runtime.Events (>= 1.10.0-preview.1)
- nanoFramework.System.Device.Gpio (>= 1.0.3-preview.3)
- nanoFramework.System.Diagnostics.Stopwatch (>= 1.0.259)
- Nerdbank.GitVersioning (>= 3.4.240)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.2.570 | 66 | 6/14/2024 |
1.2.560 | 72 | 5/29/2024 |
1.2.548 | 65 | 5/15/2024 |
1.2.436 | 418 | 11/10/2023 |
1.2.329 | 480 | 5/26/2023 |
1.2.313 | 438 | 5/12/2023 |
1.2.297 | 459 | 5/3/2023 |
1.2.275 | 552 | 3/21/2023 |
1.2.203 | 601 | 12/28/2022 |
1.2.159 | 685 | 11/14/2022 |
1.2.153 | 640 | 11/5/2022 |
1.2.141 | 746 | 10/25/2022 |
1.2.122 | 794 | 10/12/2022 |
1.2.114 | 678 | 10/8/2022 |
1.2.95 | 769 | 9/22/2022 |
1.2.87 | 842 | 9/15/2022 |
1.2.73 | 701 | 9/8/2022 |
1.1.118.19693 | 804 | 6/24/2022 |
1.1.116.8772 | 739 | 6/24/2022 |
1.1.58.10097 | 816 | 5/23/2022 |
1.1.3 | 760 | 4/15/2022 |
1.1.1 | 758 | 4/14/2022 |
1.0.277-preview.126 | 118 | 3/25/2022 |
1.0.277-preview.125 | 107 | 3/25/2022 |
1.0.277-preview.112 | 103 | 3/19/2022 |
1.0.277-preview.54 | 128 | 1/31/2022 |
1.0.277-preview.34 | 115 | 1/27/2022 |
1.0.277-preview.32 | 122 | 1/27/2022 |
1.0.277-preview.30 | 122 | 1/27/2022 |
1.0.277-preview.15 | 121 | 1/21/2022 |
1.0.277-preview.1 | 123 | 1/11/2022 |
1.0.260 | 578 | 12/10/2021 |
1.0.259 | 596 | 12/9/2021 |
1.0.217 | 683 | 10/16/2021 |
1.0.215 | 648 | 10/15/2021 |