HT1632 library not working :(

I'm trying to get HT1632 library (this one) to work with my Sure 32x16 LED display. I've connected it to my Aruduino Uno3 and tested following this wonderful and extremely helpful tutorial. Pong game works, I can plot individual dots, etc. However when I tried using Gaurav Manek's HT1632 library, I'm not getting any life signs from the LED board :frowning:
My connections mapping to arduino are as follow:
CS = pin 8
CLK = pin 9
WR = pin 7
DATA = pin 6
Here's the code, taken streight from the Github:

#include <font_5x4.h>
#include <HT1632.h>

int pinCS1 = 8;
int pinCS2 = 9;
int pinWR = 7;
int pinDATA = 6;


int wd; 
int i = 0;

void setup () {
    HT1632.begin(pinCS1, pinCS2, pinWR, pinDATA);
    wd = HT1632.getTextWidth("Hello, how are you?", FONT_5X4_WIDTH, FONT_5X4_HEIGHT);
}

void loop () {
    // Select board 1 as the target of subsequent drawing/rendering operations.
    HT1632.drawTarget(BUFFER_BOARD(1));
    HT1632.clear();

    HT1632.drawText("Hello, how are you?", 2*OUT_SIZE - i, 2,
        FONT_5X4, FONT_5X4_WIDTH, FONT_5X4_HEIGHT, FONT_5X4_STEP_GLYPH);

    HT1632.render(); // Board 1's contents is updated.

    // Select board 2 as the target of subsequent drawing/rendering operations.
    HT1632.drawTarget(BUFFER_BOARD(2));
    HT1632.clear();

    HT1632.drawText("Hello, how are you?", OUT_SIZE - i, 2,
        FONT_5X4, FONT_5X4_WIDTH, FONT_5X4_HEIGHT, FONT_5X4_STEP_GLYPH);

    HT1632.render(); // Board 2's contents is updated.

    i = (i+1)%(wd + OUT_SIZE * 2); // Make it repeating.
}

It compiles but nothing happens on the screen :frowning: Any suggestions? Is there a better library out there?

Wha if you added a delay(1000) after every display action?

it might just be that you update too fast, resulting in very fast clears() ...

or make it elementary

#include <font_5x4.h>
#include <HT1632.h>

// just to keep them as small as possible :)
uint8_t  pinCS1 = 8;
uint8_t  pinCS2 = 9;
uint8_t  pinWR = 7;
uint8_t  pinDATA = 6;
uint8_t  wd; 

void setup () 
{
    HT1632.begin(pinCS1, pinCS2, pinWR, pinDATA);
    wd = HT1632.getTextWidth("Hello, how are you?", FONT_5X4_WIDTH, FONT_5X4_HEIGHT);

    HT1632.drawTarget(BUFFER_BOARD(1));
    HT1632.clear();

    HT1632.drawText("Hello, how are you?", 2*OUT_SIZE - i, 2,
        FONT_5X4, FONT_5X4_WIDTH, FONT_5X4_HEIGHT, FONT_5X4_STEP_GLYPH);

    HT1632.render(); // Board 1's contents is updated.
}

void loop () {}

robtillaart:
Wha if you added a delay(1000) after every display action?

it might just be that you update too fast, resulting in very fast clears() ...

or make it elementary

Still nothing :frowning: BTW had to remove "i" from your code...

BTW had to remove "i" from your code

Code was not tested, but you got the idea.

Strange it does not do anything. Has it a self test modus/ splash screen?
Or can the string be too long?
(guessing)

Still not having much luck. Frankly this phrase from the library doc doesn't make sense to me:

HT1632 is always initialized by calling the begin function, like so:

HT1632.begin(pinCS1 [, pinCS2 [, pinCS3 [, pinCS4]]], pinWR, pinDATA);

What about Clock pin? Where is it defined? Maybe I'm not wiring it correctly? My display has 5 usable pins, CS, CLK, WR and DATA, and I know it's pretty standard...

This comment is from HT1632.h:

HT1632.h - Library for communicating with the popular HT1632/HT1632C
LED controllers. This library provides higher-level access (including
text drawing) for these chips. Currently, the library supports writing
to a single chip at a time, and has been tested with a single
Sure Electronics 3208 5mm red board.

florinc:
This comment is from HT1632.h:

HT1632.h - Library for communicating with the popular HT1632/HT1632C
LED controllers. This library provides higher-level access (including
text drawing) for these chips. Currently, the library supports writing
to a single chip at a time, and has been tested with a single
Sure Electronics 3208 5mm red board.

I assumed author just didn't update the text. It contradicts itself in more than one place, for example:

This library supports up to 4 chips at a time (though technically more can be run concurrently). To take advantage of this, specify multiple CS pins in the initialization.

Taken from: GitHub - gauravmm/HT1632-for-Arduino: A powerful library that allows an Arduino to interface with the popular Holtek HT1632C LED driver. :frowning:

BTW florinc, I just tried your library from WiseClock2 (Google Code Archive - Long-term storage for Google Code Project Hosting.) and it works for my setup! I'm still figuring it out, biggest issue is terrible flicker... I'm displaying letter in some COLOR then displaying same letter in BLACK color, then moving it, etc. Am I going about it wrong?

Phew, got it working! Well not the library, I abandoned all hope, but Florinc's code and it's derivatives are awesome! I even wrote my own text processor (it shows large clock digits), but all the other backend stuff I left as it was, with exception of adding brightness control:

#define LEDBrightness 8 // Set Brightness of teh display from 1-15
ht1632_sendcmd(j, HT1632_CMD_PWM +LEDBrightness); 	/* Set Brightness */

I was actually shocked that it worked, as I was just guessing :slight_smile:
Biggest issue is that clear screen function really messes up everything big time, and I don't understand why. Every time I use it RTC clock stops working (that's the strangest part) and I get artifacts on the screen that won't go away... So I'm only using it the setup and only in the very beginning, before RTC initialization. If anyone interested I'll post sketch, but I'll need to tidy it, cause it's a mess right now...

we are always interested in end results here for future reference. Tidying the code up first is also a good idea.

Idea:
the : between the hours can flash in the first 20 seconds the upper dot only, the next 20 the lower one and the last 20 seconds both dots.
Gives just a bit more precise timing.

robtillaart:
we are always interested in end results here for future reference. Tidying the code up first is also a good idea.

Idea:
the : between the hours can flash in the first 20 seconds the upper dot only, the next 20 the lower one and the last 20 seconds both dots.
Gives just a bit more precise timing.

Cool idea! Should be easy to implement, thanks!