rjbatista / tm1638-library

Automatically exported from code.google.com/p/tm1638-library
141 stars 75 forks source link

Switch on single segements #40

Closed maxholgasson closed 7 years ago

maxholgasson commented 7 years ago

Hello, Is it possible to display single segements of the numbers? I would like to use the chip to control leds instead of 7digits

rjbatista commented 7 years ago

Sure. See https://github.com/rjbatista/tm1638-library/wiki/setDisplay method.

rjbatista commented 7 years ago

+/- That depends on the module you are using.

If you are using the common cathode, yes - it's a memory position for each digit, and you'll be able to light a single segment of a single digit, but you'll have to "save" the other segments or lightning up one segment will clear the others. Each bit on a memory position is a segment of that digit.

On the common anode, yes - but it's memory position for each segment on all digits. Each bit on a memory position is the digit state of that segment.

I'd say it would be easier if you use the setDisplay with a byte array backing what you are seeing.

Something like:

// light segment values[digit] |= 0b00010000;

// update display module.setDisplay(values);

// clear segment values[digit] &= ~ 0b00010000;

// update display module.setDisplay(values);

Hope this helps.

On Thu, Nov 10, 2016 at 1:26 AM, maxholgasson notifications@github.com wrote:

Great! Thank a lot but does it light then on all the digits the same element or can I eg say only light element 1 on 2nd digit?

Am 10.11.16 um 00:19 schrieb Ricardo Batista:

Sure. See https://github.com/rjbatista/tm1638-library/wiki/setDisplay method.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/rjbatista/tm1638-library/issues/40#issuecomment-259576764, or mute the thread https://github.com/notifications/unsubscribe-auth/APVs1VAZpX-bT8EUlbxpOO42xLdkR-lEks5q8nKwgaJpZM4KmoKI .