Do not forget to include the ASCII Dictionary
You are now able to drive your 3641BS 4 times 7 segments driven by two 595 shift registers easily.
Actually you only have the ability to write char
and char[]
.
Commas are shown by a . directly in the last char.
#include <ASCIIDic.h>
#include <NX7Seg.h>
#define LATCH_DIO 4
#define CLK_DIO 7
#define DATA_DIO 8
nx7seg my4x7seg = nx7seg(LATCH_DIO,CLK_DIO,DATA_DIO);
void setup ()
{
/* Set DIO pins to outputs */
pinMode(LATCH_DIO,OUTPUT);
pinMode(CLK_DIO,OUTPUT);
pinMode(DATA_DIO,OUTPUT);
}
/* Main program */
void loop()
{
my4x7seg.writeInt(46);
my4x7seg.refresh(1000);
my4x7seg.write("abcd",4);
my4x7seg.refresh(1000);
my4x7seg.writeFloat(i);
my4x7seg.refresh(1000);
}
Constructor : If you don't have a latch (not a 595 shift register), give a pin and don't use it. If the 7 segment is reverse, then gives the argument reverse to true.
Latch could be named : RCLCK
Clock could be named : SCLK
Write a byte in the digits buffer
Clear the 7 segment buffer
Show the digit buffer on the 7 segment : Less than a millisecond. Use this if you are time dependent. Call it multiple times between time dependent steps to show the message.
Convert a char into a byte coded for the 7 segments
Show the digit buffer on the 7 segments during some time (in ms). It is approximative. It is a loop with delay(1), time times. Nothing can be done while showing numbers.
Write a char[] into the buffer array, coded by cypher. Specify the size array.
Write a char into the buffer array, coded by cypher, at the digit wanted. If wanted, add a point.
Write a number (0 to 10) into the buffer array, coded by cypher, at the digit wanted. If wanted, add a point.
Write the float value to 7 segment buffer. (refresh() or send() to show)
Write the float value to 7 segment buffer. (refresh() or send() to show)
- Change the direction of the chars. Right to left instead of left to right for some 3641BS soldered differently.
Alexis Paques (@AlexisTM)