Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2 digit module doesn't work #17

Open
SnJon opened this issue May 10, 2021 · 0 comments
Open

2 digit module doesn't work #17

SnJon opened this issue May 10, 2021 · 0 comments

Comments

@SnJon
Copy link

SnJon commented May 10, 2021

Cool library! But I can't get this module to work correctly (work only first digit). It completely coincides with the schematic description for the library.
I am using the following code from the example:
`/*
ShiftDisplay example
by MiguelPynto
Print strings from Serial Monitor (250000 baud) on display
https://miguelpynto.github.io/ShiftDisplay/
*/

#include <ShiftDisplay.h>

const int LATCH_PIN = 6;
const int CLOCK_PIN = 7;
const int DATA_PIN = 5;
const DisplayType DISPLAY_TYPE = COMMON_ANODE; // COMMON_CATHODE or COMMON_ANODE
const int DISPLAY_SIZE = 2; // number of digits on display

ShiftDisplay display(LATCH_PIN, CLOCK_PIN, DATA_PIN, DISPLAY_TYPE, DISPLAY_SIZE);

void readSerial() {
char input[Serial.available() + 1]; // str len + NULL
int i = 0;
do {
char c = Serial.read();
if (c == '\n' || c == '\0')
break; // exit while
input[i++] = c;
} while (Serial.available() > 0);
input[i] = '\0'; // NULL terminate string
display.set(input); // save
}

void setup() {
Serial.begin(250000);
}

void loop() {
if (Serial.available() > 0)
readSerial();
display.update();
}`

What I'm doing wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant