From fffa30fa28bc3ff01db867a76beb804bab909e1f Mon Sep 17 00:00:00 2001 From: Blake Tourneur Date: Sun, 1 Dec 2019 14:36:30 +1030 Subject: [PATCH] 2.5.0 - External number matrix This update makes the large variable numMatrix, which contains all the characters so they can be displayed on a screen, an external variable in a seperate file called 7seg_matrix.h --- library.properties | 2 +- src/7seg_matrix.h | 66 ++++++++++++++++++++++++++++++++++++++++++ src/sevenSegment.cpp | 68 +------------------------------------------- 3 files changed, 68 insertions(+), 68 deletions(-) create mode 100644 src/7seg_matrix.h diff --git a/library.properties b/library.properties index 61dec43..4ad1b0a 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=sevenSegment -version=2.4.1 +version=2.5.0 author=Blake Tourneur maintainer=Blake Tourneur sentence=Control infinite seven segment displays with your arduino! diff --git a/src/7seg_matrix.h b/src/7seg_matrix.h new file mode 100644 index 0000000..d1c6edc --- /dev/null +++ b/src/7seg_matrix.h @@ -0,0 +1,66 @@ +const int sevenSegment::_numMatrix[62][8] PROGMEM { + //segments + //g,f,e,d,c,b,a,dp + {0,1,1,1,1,1,1,0}, //ZERO + {0,0,0,0,1,1,0,0}, //ONE + {1,0,1,1,0,1,1,0}, //TWO + {1,0,0,1,1,1,1,0}, //THREE + {1,1,0,0,1,1,0,0}, //FOUR + {1,1,0,1,1,0,1,0}, //FIVE + {1,1,1,1,1,0,1,0}, //SIX + {0,0,0,0,1,1,1,0}, //SEVEN + {1,1,1,1,1,1,1,0}, //EIGHT + {1,1,0,1,1,1,1,0}, //NINE + {1,1,1,0,1,1,1,0}, //LETTER A + {1,1,1,1,1,0,0,0}, //LETTER B + {0,1,1,1,0,0,1,0}, //LETTER C + {1,0,1,1,1,1,0,0}, //LETTER D + {1,1,1,1,0,0,1,0}, //LETTER E + {1,1,1,0,0,0,1,0}, //LETTER F + {0,1,1,1,1,0,1,0}, //LETTER G + {1,1,1,0,1,0,0,0}, //LETTER H + {0,1,1,0,0,0,0,0}, //LETTER I + {0,0,1,1,1,1,0,0}, //LETTER J + {1,1,1,0,1,0,1,0}, //LETTER K + {0,1,1,1,0,0,0,0}, //LETTER L + {0,0,1,0,1,0,1,0}, //LETTER M + {0,1,1,0,1,1,1,0}, //LETTER N + {0,1,1,1,1,1,1,0}, //LETTER O + {1,1,1,0,0,1,1,0}, //LETTER P + {1,1,0,0,1,1,1,0}, //LETTER Q + {0,1,1,0,0,1,1,0}, //LETTER R + {1,1,0,1,1,0,1,0}, //LETTER S + {1,1,1,1,0,0,0,0}, //LETTER T + {0,1,1,1,1,1,0,0}, //LETTER U + {0,1,0,1,1,1,0,0}, //LETTER V + {0,1,0,1,0,1,0,0}, //LETTER W + {1,1,1,0,1,1,0,0}, //LETTER X + {1,1,0,1,1,1,0,0}, //LETTER Y + {1,0,0,1,0,1,1,0}, //LETTER Z + {0,0,0,0,0,0,0,0}, //BLANK + {0,1,0,0,0,1,0,0}, //CHARACTER " + {0,1,1,0,1,1,0,0}, //CHARACTER # + {1,1,0,1,0,0,1,0}, //CHARACTER $ + {0,1,0,1,1,0,1,0}, //CHARACTER % + {1,1,1,1,0,1,1,0}, //CHARACTER & + {0,0,0,0,0,1,0,0}, //CHARACTER ' ` + {0,1,1,1,0,0,1,0}, //CHARACTER ( [ { + {0,0,0,1,1,1,1,0}, //CHARACTER ) ] } + {1,1,0,0,0,1,1,0}, //CHARACTER * + {1,1,1,0,0,0,0,0}, //CHARACTER + + {0,0,0,1,1,0,0,0}, //CHARACTER , + {1,0,0,0,0,0,0,0}, //CHARACTER - ~ + {1,0,0,0,0,1,0,0}, //CHARACTER / + {1,0,0,1,0,0,0,0}, //CHARACTER : + {1,0,0,1,1,0,0,0}, //CHARACTER ; + {1,1,0,0,0,0,1,0}, //CHARACTER < + {1,0,0,0,0,0,1,0}, //CHARACTER = + {1,0,0,0,0,1,1,0}, //CHARACTER > + {1,0,1,0,0,1,1,0}, //CHARACTER ? + {1,0,1,1,1,1,1,0}, //CHARACTER @ + {1,1,0,0,0,0,0,0}, //CHARACTER (back slash) + {0,1,0,0,0,1,1,0}, //CHARACTER ^ + {0,0,0,1,0,0,0,0}, //CHARACTER _ + {0,0,0,0,0,1,0,1}, //CHARACTER ! + {0,0,0,0,0,0,0,1} //CHARACTER . +}; \ No newline at end of file diff --git a/src/sevenSegment.cpp b/src/sevenSegment.cpp index 0a26591..7bd2da1 100644 --- a/src/sevenSegment.cpp +++ b/src/sevenSegment.cpp @@ -7,73 +7,7 @@ #include "Arduino.h" #include "sevenSegment.h" - -const int sevenSegment::_numMatrix[62][8] PROGMEM { - //segments - //g,f,e,d,c,b,a,dp - {0,1,1,1,1,1,1,0}, //ZERO - {0,0,0,0,1,1,0,0}, //ONE - {1,0,1,1,0,1,1,0}, //TWO - {1,0,0,1,1,1,1,0}, //THREE - {1,1,0,0,1,1,0,0}, //FOUR - {1,1,0,1,1,0,1,0}, //FIVE - {1,1,1,1,1,0,1,0}, //SIX - {0,0,0,0,1,1,1,0}, //SEVEN - {1,1,1,1,1,1,1,0}, //EIGHT - {1,1,0,1,1,1,1,0}, //NINE - {1,1,1,0,1,1,1,0}, //LETTER A - {1,1,1,1,1,0,0,0}, //LETTER B - {0,1,1,1,0,0,1,0}, //LETTER C - {1,0,1,1,1,1,0,0}, //LETTER D - {1,1,1,1,0,0,1,0}, //LETTER E - {1,1,1,0,0,0,1,0}, //LETTER F - {0,1,1,1,1,0,1,0}, //LETTER G - {1,1,1,0,1,0,0,0}, //LETTER H - {0,1,1,0,0,0,0,0}, //LETTER I - {0,0,1,1,1,1,0,0}, //LETTER J - {1,1,1,0,1,0,1,0}, //LETTER K - {0,1,1,1,0,0,0,0}, //LETTER L - {0,0,1,0,1,0,1,0}, //LETTER M - {0,1,1,0,1,1,1,0}, //LETTER N - {0,1,1,1,1,1,1,0}, //LETTER O - {1,1,1,0,0,1,1,0}, //LETTER P - {1,1,0,0,1,1,1,0}, //LETTER Q - {0,1,1,0,0,1,1,0}, //LETTER R - {1,1,0,1,1,0,1,0}, //LETTER S - {1,1,1,1,0,0,0,0}, //LETTER T - {0,1,1,1,1,1,0,0}, //LETTER U - {0,1,0,1,1,1,0,0}, //LETTER V - {0,1,0,1,0,1,0,0}, //LETTER W - {1,1,1,0,1,1,0,0}, //LETTER X - {1,1,0,1,1,1,0,0}, //LETTER Y - {1,0,0,1,0,1,1,0}, //LETTER Z - {0,0,0,0,0,0,0,0}, //BLANK - {0,1,0,0,0,1,0,0}, //CHARACTER " - {0,1,1,0,1,1,0,0}, //CHARACTER # - {1,1,0,1,0,0,1,0}, //CHARACTER $ - {0,1,0,1,1,0,1,0}, //CHARACTER % - {1,1,1,1,0,1,1,0}, //CHARACTER & - {0,0,0,0,0,1,0,0}, //CHARACTER ' ` - {0,1,1,1,0,0,1,0}, //CHARACTER ( [ { - {0,0,0,1,1,1,1,0}, //CHARACTER ) ] } - {1,1,0,0,0,1,1,0}, //CHARACTER * - {1,1,1,0,0,0,0,0}, //CHARACTER + - {0,0,0,1,1,0,0,0}, //CHARACTER , - {1,0,0,0,0,0,0,0}, //CHARACTER - ~ - {1,0,0,0,0,1,0,0}, //CHARACTER / - {1,0,0,1,0,0,0,0}, //CHARACTER : - {1,0,0,1,1,0,0,0}, //CHARACTER ; - {1,1,0,0,0,0,1,0}, //CHARACTER < - {1,0,0,0,0,0,1,0}, //CHARACTER = - {1,0,0,0,0,1,1,0}, //CHARACTER > - {1,0,1,0,0,1,1,0}, //CHARACTER ? - {1,0,1,1,1,1,1,0}, //CHARACTER @ - {1,1,0,0,0,0,0,0}, //CHARACTER (back slash) - {0,1,0,0,0,1,1,0}, //CHARACTER ^ - {0,0,0,1,0,0,0,0}, //CHARACTER _ - {0,0,0,0,0,1,0,1}, //CHARACTER ! - {0,0,0,0,0,0,0,1} //CHARACTER . -}; +#include "7seg_matrix.h" sevenSegment::sevenSegment(int sega, int segb, int segc, int segd, int sege, int segf, int segg, bool cathode){ pinMode(sega, OUTPUT);