Skip to content

Instantly share code, notes, and snippets.

@Yornik Yornik/clock.ino
Last active May 19, 2020

Embed
What would you like to do?
#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
You can’t perform that action at this time.