nanoFramework.Iot.Device.Tm1637 1.0.259

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package nanoFramework.Iot.Device.Tm1637 --version 1.0.259                
NuGet\Install-Package nanoFramework.Iot.Device.Tm1637 -Version 1.0.259                
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.0.259" />                
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.0.259                
#r "nuget: nanoFramework.Iot.Device.Tm1637, 1.0.259"                
#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.0.259

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

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.673 83 10/23/2024
1.2.662 84 10/11/2024
1.2.631 96 8/28/2024
1.2.570 94 6/14/2024
1.2.560 91 5/29/2024
1.2.548 91 5/15/2024
1.2.436 445 11/10/2023
1.2.329 502 5/26/2023
1.2.313 453 5/12/2023
1.2.297 479 5/3/2023
1.2.275 574 3/21/2023
1.2.203 621 12/28/2022
1.2.159 704 11/14/2022
1.2.153 673 11/5/2022
1.2.141 771 10/25/2022
1.2.122 816 10/12/2022
1.2.114 697 10/8/2022
1.2.95 789 9/22/2022
1.2.87 864 9/15/2022
1.2.73 721 9/8/2022
1.1.118.19693 826 6/24/2022
1.1.116.8772 762 6/24/2022
1.1.58.10097 838 5/23/2022
1.1.3 781 4/15/2022
1.1.1 783 4/14/2022
1.0.277-preview.126 127 3/25/2022
1.0.277-preview.125 116 3/25/2022
1.0.277-preview.112 113 3/19/2022
1.0.277-preview.54 136 1/31/2022
1.0.277-preview.34 122 1/27/2022
1.0.277-preview.32 130 1/27/2022
1.0.277-preview.30 128 1/27/2022
1.0.277-preview.15 129 1/21/2022
1.0.277-preview.1 131 1/11/2022
1.0.260 604 12/10/2021
1.0.259 617 12/9/2021
1.0.217 707 10/16/2021
1.0.215 670 10/15/2021