This commit is contained in:
@@ -3,8 +3,6 @@ TM1638.h - Library for TM1638.
|
|||||||
|
|
||||||
Copyright (C) 2011 Ricardo Batista (rjbatista <at> gmail <dot> com)
|
Copyright (C) 2011 Ricardo Batista (rjbatista <at> gmail <dot> com)
|
||||||
|
|
||||||
Based on a sketch by: Martin Hubacek (http://www.martinhubacek.cz)
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the version 3 GNU General Public License as
|
it under the terms of the version 3 GNU General Public License as
|
||||||
published by the Free Software Foundation.
|
published by the Free Software Foundation.
|
||||||
@@ -118,7 +116,7 @@ void TM1638::clearDisplay()
|
|||||||
void TM1638::setDisplayToString(const char* string, const byte dots, const byte font[])
|
void TM1638::setDisplayToString(const char* string, const byte dots, const byte font[])
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
sendData(i << 1, font[string[i] - 32] | ((dots & (1 << i)) != 0 ? 0b10000000 : 0));
|
sendData(i << 1, font[string[i] - 32] | ((dots & (1 << (7 - i))) != 0 ? 0b10000000 : 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +126,7 @@ void TM1638::setDisplayToString(const String string, const byte dots, const byte
|
|||||||
|
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
if (i < stringLength) {
|
if (i < stringLength) {
|
||||||
sendData(i << 1, font[string.charAt(i) - 32] | ((dots & (1 << i)) != 0 ? 0b10000000 : 0));
|
sendData(i << 1, font[string.charAt(i) - 32] | ((dots & (1 << (7 - i))) != 0 ? 0b10000000 : 0));
|
||||||
} else {
|
} else {
|
||||||
sendData(i << 1, 0);
|
sendData(i << 1, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
2
TM1638.h
2
TM1638.h
@@ -3,8 +3,6 @@ TM1638.h - Library for TM1638.
|
|||||||
|
|
||||||
Copyright (C) 2011 Ricardo Batista <rjbatista at gmail dot com>
|
Copyright (C) 2011 Ricardo Batista <rjbatista at gmail dot com>
|
||||||
|
|
||||||
Based on a sketch by: Martin Hubacek (http://www.martinhubacek.cz)
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the version 3 GNU General Public License as
|
it under the terms of the version 3 GNU General Public License as
|
||||||
published by the Free Software Foundation.
|
published by the Free Software Foundation.
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#include <TM1638.h>
|
#include <TM1638.h>
|
||||||
|
|
||||||
// define a module on data pin 3, clock pin 9 and strobe pin 7
|
// define a module on data pin 8, clock pin 9 and strobe pin 7
|
||||||
TM1638 module(8, 9, 7);
|
TM1638 module(8, 9, 7);
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
|||||||
Reference in New Issue
Block a user