hello,
(i previs this post with saying i am new to arduino.) I am an IT professional with mild programming experience.
this started with me trying to repair a scoreboard at a local inline hockey rink. The old scoreboard had 120V circuits with incandescent lightbulbs and hasn't worked in years. Called the manufacturer and no parts to fix. The idea is to upgrade the scoreboard to LEDs and use an arduino board to control. The total scoreboard will have 2 digits for the home team, 2 digits for the Guest team, 4 digits for the time clock. i LED each for periods 1-3 with 1 LED for OT. with other potential functionality.
I am testing this using tinkercad. It has the Adafruit_NeoPixel library.
All I want to do at this point is use the serialinput in tinkercad to send a number and have it display on the LEDs. I'm sure once I figure this out I'll have more questions but I'm trying to start small.
I've attached a picture of what this looks like in tinkercad
digital pin for LEDs is pin 6.
I want to start with learning how to display a 2 digit number in an LED matrix.
Any help or advice will be greatly appreciated.
i know this is very incomplete, but here's what i have so far, but this is mostly borrowed code. I'm not sure where to go from here with regard to the serialinput and getting it to display on the LED matrix:
#include <Adafruit_NeoPixel.h>
#define PIN 6
#define NUMPIXELS 56
const int characterOffset = 28; //character offset for next digit
int charLayout[10][27] = {
{1,1,1,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,1,1,1}, //0
{0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1}, //1
{1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1}, //2
{1,1,1,1,1,0,0,0,0,0,0,1,1,1,1,1,0,0,0,1,1,0,0,0,1,1,1,1}, //3
{1,0,0,1,1,0,0,1,1,0,0,1,1,1,1,1,0,0,0,1,1,0,0,0,0,0,0,1}, //4
{1,1,1,1,0,0,0,1,1,0,0,0,1,1,1,1,0,0,0,1,1,0,0,0,1,1,1,1}, //5
{1,1,1,1,0,0,0,1,1,0,0,0,1,1,1,1,1,0,0,1,1,0,0,1,1,1,1,1}, //6
{1,1,1,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1}, //7
{1,1,1,1,1,0,0,1,1,0,0,1,1,1,1,1,1,0,0,1,1,0,0,1,1,1,1,1}, //8
{1,1,1,1,1,0,0,1,1,0,0,1,1,1,1,1,0,0,0,1,1,0,0,0,0,0,0,1}, //9
} ;
void setup() {
Serial.begin(9600); // initialize serial communication
pixels.begin(); // This initializes the NeoPixel library.
pinMode(6, OUTPUT);
}
void loop() {
}
void setNumber(int side, int displayNum) {
int sideOffset = sidecharacterOffset2;
int ones = (displayNum%10);
int tens = ((displayNum/10)%10);
for(int k=0;k<15;k++){
toggleLocation(side, k+sideOffset, charLayout[tens][k]);
toggleLocation(side, k+characterOffset+sideOffset, charLayout[ones][k]);
}
pixels.show();
}
