nanoFramework.Iot.Device.Tm1637 1.2.436

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package nanoFramework.Iot.Device.Tm1637 --version 1.2.436
NuGet\Install-Package nanoFramework.Iot.Device.Tm1637 -Version 1.2.436
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="nanoFramework.Iot.Device.Tm1637" Version="1.2.436" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add nanoFramework.Iot.Device.Tm1637 --version 1.2.436
#r "nuget: nanoFramework.Iot.Device.Tm1637, 1.2.436"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install nanoFramework.Iot.Device.Tm1637 as a Cake Addin
#addin nuget:?package=nanoFramework.Iot.Device.Tm1637&version=1.2.436

// Install nanoFramework.Iot.Device.Tm1637 as a Cake Tool
#tool nuget:?package=nanoFramework.Iot.Device.Tm1637&version=1.2.436

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

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);

tm1637

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 Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.436 408 11/10/2023
1.2.329 474 5/26/2023
1.2.313 435 5/12/2023
1.2.297 456 5/3/2023
1.2.275 548 3/21/2023
1.2.203 594 12/28/2022
1.2.159 682 11/14/2022
1.2.153 639 11/5/2022
1.2.141 744 10/25/2022
1.2.122 790 10/12/2022
1.2.114 677 10/8/2022
1.2.95 764 9/22/2022
1.2.87 834 9/15/2022
1.2.73 700 9/8/2022
1.1.118.19693 802 6/24/2022
1.1.116.8772 738 6/24/2022
1.1.58.10097 813 5/23/2022
1.1.3 756 4/15/2022
1.1.1 754 4/14/2022
1.0.277-preview.126 116 3/25/2022
1.0.277-preview.125 106 3/25/2022
1.0.277-preview.112 102 3/19/2022
1.0.277-preview.54 127 1/31/2022
1.0.277-preview.34 114 1/27/2022
1.0.277-preview.32 121 1/27/2022
1.0.277-preview.30 121 1/27/2022
1.0.277-preview.15 120 1/21/2022
1.0.277-preview.1 122 1/11/2022
1.0.260 576 12/10/2021
1.0.259 595 12/9/2021
1.0.217 681 10/16/2021
1.0.215 647 10/15/2021