I have created a library that interfaces to that board, however I have not yet documented it, so I haven't announced it formally. It allows display of floating point numbers on the display, with the decimal point any any of the 4 locations, or not present. It also allows display of individual digits in any position, and supports fading in and out of the display. I am still working on it, and plan to document it and put it up on my web site, but you can access it now at http://docmorbius.net/arduino/SevenSegment.zip.
There is an example in there that may help to explain how to use it.
Good luck
Have been playing with your library - a few bugs when the digits get bigger but it works nicely!
FYI I have mapped all the characters you can do on the display...
Those with // are where the upper or lower case has been substituted. Obviously some characters you cannot do - so it's still limited.
case '0': return 0xfc;
case '1': return 0x60;
case '2': return 0xda;
case '3': return 0xf2;
case '4': return 0x66;
case '5': return 0xb6;
case '6': return 0xbe;
case '7': return 0xe0;
case '8': return 0xfe;
case '9': return 0xf6;
case 'A': return 0xee;
case 'a': return 0xfa;
case 'B': return 0x3e; //
case 'b': return 0x3e;
case 'c': return 0x1a;
case 'C': return 0x9c;
case 'D': return 0x7a; //
case 'd': return 0x7a;
case 'e': return 0xde;
case 'E': return 0x9e;
case 'F': return 0x8e;
case 'f': return 0x8e; //
case 'G': return 0xf6; //
case 'g': return 0xf6;
case 'H': return 0x6e;
case 'h': return 0x2e;
case 'I': return 0x60;
case 'i': return 0x08;
case 'J': return 0x70;
case 'j': return 0x70; //
case 'L': return 0x1c;
case 'l': return 0x0c;
case 'N': return 0xec;
case 'n': return 0x2a;
case 'O': return 0x3a; //
case 'o': return 0x3a;
case 'P': return 0xce;
case 'p': return 0xce; //
case 'Q': return 0xe6; //
case 'q': return 0xe6;
case 'R': return 0x0a; //
case 'r': return 0x0a;
case 'S': return 0xb6;
case 's': return 0xb6; //
case 'T': return 0x1e; //
case 't': return 0x1e;
case 'U': return 0x7c;
case 'u': return 0x38;
case 'Y': return 0x76; //
case 'y': return 0x76;
case '-': return 0x02;
case '?': return 0xcb;
case '=': return 0x12;
case '"': return 0x44;
default : return 0x00;
I'm not sure what you mean by "a few bugs when the digits get bigger".
If there are bugs, I'd like to fix them. Can you describe the problem in more detail?
I'll incorporate your character values into the code, if that's OK with you.
I think I tired to make it count up in +0.05 or something - when the numbers got too big for the display it went a bit mental.
Here are some updated character codes:
case '0':
return 0xfc;
case '1':
return 0x60;
case '2':
return 0xda;
case '3':
return 0xf2;
case '4':
return 0x66;
case '5':
return 0xb6;
case '6':
return 0xbe;
case '7':
return 0xe0;
case '8':
return 0xfe;
case '9':
return 0xf6;
case 'A':
return 0xee;
case 'a':
return 0xfa;
case 'B':
return 0x3e; //
case 'b':
return 0x3e;
case 'c':
return 0x1a;
case 'C':
return 0x9c;
case 'D':
return 0x7a; //
case 'd':
return 0x7a;
case 'e':
return 0xde;
case 'E':
return 0x9e;
case 'F':
return 0x8e;
case 'f':
return 0x8e; //
case 'G':
return 0xf6; //
case 'g':
return 0xf6;
case 'H':
return 0x6e;
case 'h':
return 0x2e;
case 'I':
return 0x60;
case 'i':
return 0x08;
case 'J':
return 0x78;
case 'j':
return 0x70;
case 'L':
return 0x1c;
case 'l':
return 0x0c;
case 'N':
return 0xec;
case 'n':
return 0x2a;
case 'O':
return 0x3a; //
case 'o':
return 0x3a;
case 'P':
return 0xce;
case 'p':
return 0xce; //
case 'Q':
return 0xe6; //
case 'q':
return 0xe6;
case 'R':
return 0x0a; //
case 'r':
return 0x0a;
case 'S':
return 0xb6;
case 's':
return 0xb6; //
case 'T':
return 0x1e; //
case 't':
return 0x1e;
case 'U':
return 0x7c;
case 'u':
return 0x38;
case 'Y':
return 0x76; //
case 'y':
return 0x76;
case '-':
return 0x02;
case '?':
return 0xcb;
case '=':
return 0x12;
case '"':
return 0x44;
default :
return 0x00;
Ok. I have updated the library to fix the bug you mentioned,
and added the ability to display characters, and fixed some other
things. I have also documented it.
I am getting my display showing 101.0 when I use this:
#include <SevenSegment.h>
#define DIM 6 // This pin turns off the display when set LOW
#define CLK 4 // This is the clock pin
#define DATA 3 // This is the data pin
#define MAXDIGITS 4 // number of display digits
SevenSegment seg = SevenSegment(DATA,CLK,DIM,MAXDIGITS); // Create the SevenSegment Object
double value = 100.0;
void setup() {
seg.displayNum(value,1,0);
}
void loop() {
}
I just spent some time debugging and, believe it or not, I found that the pow() function in the C library was returning 99 instead of 100 for 10 to the power of 2, or at least when the floating number returned by pow() was cast to a long that's what was returned. Wow!
I replaced the calls to the C library pow() function with my own private function and the problem seems to be fixed.
It's not a bug, it's a feature! That pow function is floating point, and rounding will occur. There was at least one thread about it in April (Google "site:arduino.cc floating point pow function").
I'm trying to use this library/codes with a Sure Electronics DE-DP003 2.3" display but I'm getting weird characters. I'm sure that I'm missing something simple.