Skip to content

Instantly share code, notes, and snippets.

@Yornik
Last active May 19, 2020 18:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yornik/4f389cf738b04fcdd16d426f9ed69e1d to your computer and use it in GitHub Desktop.
Save Yornik/4f389cf738b04fcdd16d426f9ed69e1d to your computer and use it in GitHub Desktop.
#include <stdint.h>
#include <Arduino.h>
#include <FastLED.h>
#define DATA_PIN_LED 27
static CRGB leds[25];
void setup(void)
{
Serial.begin(115200);
FastLED.addLeds < WS2812B, DATA_PIN_LED, GRB > (leds, 25);
FastLED.setBrightness(20);
}
void loop(void)
{
static int cubestartpoint[] = {0,0,0};
static int state = 0;
static int Numbersprite = 0;
static int tenssprite = 1;
static int hunderdssprite = 1;
static int thousendssprite = 1;
static int place = 0;
static int cube[10][25]={{0,1,1,1,0,
1,1,0,1,1,
1,0,0,0,1,
1,1,0,1,1,
0,1,1,1,0},
{0,0,1,1,0,
0,1,0,1,0,
1,0,0,1,0,
0,0,0,1,0,
1,1,1,1,1},
{1,1,1,1,0,
0,0,1,1,1,
0,1,1,0,0,
1,1,0,0,0,
1,1,1,1,1},
{1,1,1,1,1,
0,0,0,0,1,
1,1,1,1,1,
0,0,0,0,1,
1,1,1,1,1},
{0,0,0,0,1,
0,0,1,1,1,
0,1,1,0,1,
1,1,1,1,1,
0,0,0,1,0},
{1,1,1,1,1,
1,0,0,0,0,
1,1,1,1,1,
0,0,0,0,1,
1,1,1,1,1},
{1,1,1,1,1,
1,0,0,0,0,
1,1,1,1,1,
1,0,0,0,1,
1,1,1,1,1},
{1,1,1,1,1,
0,0,0,1,1,
0,0,1,1,0,
0,1,1,0,0,
1,1,0,0,0},
{1,1,1,1,1,
1,0,0,0,1,
1,1,1,1,1,
1,0,0,0,1,
1,1,1,1,1},
{1,1,1,1,1,
1,0,0,0,1,
1,1,1,1,1,
0,0,0,0,1,
1,1,1,1,1},
};
if(Numbersprite < 10){
if(place < 25){
int state = { cube[Numbersprite][place]};
if(state){
leds[place] = CRGB::White;
};
if(!state){
leds[place] = CRGB::Black;
};
place++;
};
if(place > 24){
Numbersprite++;
place = 0;
delay(1000);
FastLED.show();
};
};
if(Numbersprite >= 10 and tenssprite <= 9){
if(place < 25){
int state = { cube[tenssprite][place]};
if(state){
leds[place] = CRGB::Blue;
};
if(!state){
leds[place] = CRGB::Black;
};
place++;
};
if(place > 24){
tenssprite++;
place = 0;
Numbersprite = 0;
delay(1000);
FastLED.show();
};
};
if(Numbersprite >= 10 and tenssprite >= 10 ){
if(place < 25){
int state = { cube[hunderdssprite][place]};
if(state){
leds[place] = CRGB::Red;
};
if(!state){
leds[place] = CRGB::Black;
};
place++;
};
if(place > 24){
hunderdssprite++;
place = 0;
Numbersprite = 0;
tenssprite = 1;
delay(1000);
FastLED.show();
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment