Go Down

Topic: HT1632 library not working :( (Read 1 time) previous topic - next topic

bratan

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 :(
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:
Code: [Select]
#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 :(  Any suggestions?  Is there a better library out there?
Xronos Clock - A talking arduino based alarm clock is now available. Check out xronosclock.com for pictures, source code, schematics, and purchasing info :)

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
Code: [Select]

#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 () {}
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

bratan



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 :(  BTW had to remove "i" from your code...
Xronos Clock - A talking arduino based alarm clock is now available. Check out xronosclock.com for pictures, source code, schematics, and purchasing info :)

robtillaart

Quote
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)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

bratan

Still not having much luck. Frankly this phrase from the library doc doesn't make sense to me:
Quote
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...
Xronos Clock - A talking arduino based alarm clock is now available. Check out xronosclock.com for pictures, source code, schematics, and purchasing info :)

florinc

This comment is from HT1632.h:
Quote
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.


bratan

#6
Nov 09, 2012, 02:33 pm Last Edit: Nov 09, 2012, 02:58 pm by bratan Reason: 1

This comment is from HT1632.h:
Quote
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:
Quote
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: https://github.com/gauravmm/HT1632-for-Arduino  :(

BTW florinc, I just tried your library from WiseClock2 (http://code.google.com/p/wiseclock2/downloads/detail?name=HT1632.zip&can=2&q=#makechanges) 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?
Xronos Clock - A talking arduino based alarm clock is now available. Check out xronosclock.com for pictures, source code, schematics, and purchasing info :)

bratan

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:
Code: [Select]
#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 :)
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...
http://www.youtube.com/watch?v=hrluGXlrfyk
Xronos Clock - A talking arduino based alarm clock is now available. Check out xronosclock.com for pictures, source code, schematics, and purchasing info :)

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.

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

bratan


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!
Xronos Clock - A talking arduino based alarm clock is now available. Check out xronosclock.com for pictures, source code, schematics, and purchasing info :)

Go Up