i was making pov display with 10 leds using arduino
but it seems it is not working as it should
here is the code
https://hastebin.com/etovafuvab.cpp
i would appreciate an kind of help
Moderators note: copied code to forum
but it seems it is not working as it should
here is the code
https://hastebin.com/etovafuvab.cpp
i would appreciate an kind of help
Code:
#include <FastLED.h>
int led = 9;
int hall = 7;
int State = 0;
int lastState = 0;
CRGB leds[10];
boolean H[]={1,1,1,1,1,1,1,1,1,1, 0,0,0,0,0,1,0,0,0,0 ,0,0,0,0,0,1,0,0,0,0 ,0,0,0,0,0,1,0,0,0,0 ,1,1,1,1,1,1,1,1,1,1};
boolean A[]={0,0,0,0,0,0,0,0,0,1 ,0,0,0,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,0,1,0,0,0,0,0 ,1,0,0,0,1,0,0,0,0,0 ,0,1,1,0,1,0,0,0,0,0 ,0,0,0,1,1,0,0,0,0,0 ,0,0,0,0,0,1,1,0,0,0 ,0,0,0,0,0,0,0,1,1,0 ,0,0,0,0,0,0,0,0,0,1};
boolean P[]={1,1,1,1,1,1,1,1,1,1 ,1,0,0,1,0,0,0,0,0,0 ,1,0,0,1,0,0,0,0,0,0 ,0,1,1,0,0,0,0,0,0,0};
boolean Y[]={1,0,0,0,0,0,0,0,0,0 ,0,1,1,0,0,0,0,0,0,0 ,0,0,0,1,1,1,1,1,1,1 ,0,1,1,0,0,0,0,0,0,0 ,1,0,0,0,0,0,0,0,0,0};
boolean B[]={1,1,1,1,1,1,1,1,1,1 ,1,0,0,1,0,0,0,0,0,1 ,1,0,0,1,0,0,0,0,0,1 ,0,1,1,0,1,0,0,0,1,0 ,0,0,0,0,0,1,1,1,0,0};
boolean T[]={1,0,0,0,0,0,0,0,0,0 ,1,0,0,0,0,0,0,0,0,0 ,1,1,1,1,1,1,1,1,1,1 ,1,0,0,0,0,0,0,0,0,0 ,1,0,0,0,0,0,0,0,0,0};
boolean R[]={1,1,1,1,1,1,1,1,1,1 ,1,0,0,1,1,0,0,0,0,0 ,1,0,0,1,0,1,0,0,0,0 ,0,1,1,0,0,0,1,0,0,0 ,0,0,0,0,0,0,0,1,0,0 ,0,0,0,0,0,0,0,0,1,0 ,0,0,0,0,0,0,0,0,0,1};
boolean D[]={1,1,1,1,1,1,1,1,1,1 ,1,0,0,0,0,0,0,0,0,1 ,0,1,0,0,0,0,0,0,1,0 ,0,0,1,0,0,0,0,1,0,0 ,0,0,0,1,1,1,1,0,0,0};
boolean I[]={1,1,1,1,1,1,1,1,1,1};
boolean S[]={0,0,0,0,0,0,0,0,0,0};
boolean E[]={1,1,1,1,1,1,1,1,1,1 ,1,0,0,0,1,0,0,0,0,1 ,1,0,0,0,1,0,0,0,0,1 ,1,0,0,0,1,0,0,0,0,1 ,1,0,0,0,1,0,0,0,0,1};
boolean O[]={1,1,1,1,1,1,1,1,1,1 ,1,0,0,0,0,0,0,0,0,1 ,1,0,0,0,0,0,0,0,0,1 ,1,0,0,0,0,0,0,0,0,1 ,1,1,1,1,1,1,1,1,1,1};
int m =0;
void setup(){
pinMode(led,OUTPUT);
pinMode(hall,INPUT);
FastLED.addLeds<WS2811, 9, GRB>(leds, 10).setCorrection( TypicalLEDStrip );
}
void loop(){
State = digitalRead(hall);
if (State != lastState){
if (State == HIGH){
writefive(H);
writeone(S);
writeeleven(A);
writeone(S);
writefour(P);
writeone(S);
writefour(P);
writeone(S);
writefive(Y);
writeone(S);
writeone(S);
writefive(B);
writeone(S);
writeone(I);
writeone(S);
writeseven(R);
writeone(S);
writefive(T);
writeone(S);
writefive(H);
writeone(S);
writefive(D);
writeone(S);
writeeleven(A);
writeone(S);
writefive(Y);
writeone(S);
writeone(S);
writefive(T);
writeone(S);
writefive(O);
writeone(S);
writeone(S);
writeeleven(A);
writeone(S);
writeseven(R);
writeone(S);
writefive(E);
writeone(S);
writefive(E);
writeone(S);
writefive(B);
writeone(S);
writeeleven(A);
}
lastState = State;
}
}
void writeone(boolean letter[]){
m=0;
for(int i=0;i<=9;i++){
if(letter[m]==1){
leds[i] = CRGB(255, 255, 255);
}
else{
leds[i] = CRGB(0, 0, 0);
}
FastLED.show();
m++;
}
delayMicroseconds(700);
}
void writefour(boolean letter[]){
m=0;
for(int n=0; n<=3; n++){
for(int i=0; i<=9; i++){
if(letter[m]==1){
leds[i] = CRGB(255, 255, 255);
}
else{
leds[i] = CRGB(0, 0, 0);
}
FastLED.show();
m++;
}
delayMicroseconds(700);
}
}
void writefive(boolean letter[]){
m=0;
for(int n=0; n<=4; n++){
for(int i=0; i<=9; i++){
if(letter[m]==1){
leds[i] = CRGB(255, 255, 255);
}
else{
leds[i] = CRGB(0, 0, 0);
}
FastLED.show();
m++;
}
delayMicroseconds(700);
}
}
void writeseven(boolean letter[]){
m=0;
for(int n=0; n<=6; n++){
for(int i=0; i<=9; i++){
if(letter[m]==1){
leds[i] = CRGB(255, 255, 255);
}
else{
leds[i] = CRGB(0, 0, 0);
}
FastLED.show();
m++;
}
delayMicroseconds(600);
}
}
void writeeleven(boolean letter[]){
m=0;
for(int n=0; n<=10; n++){
for(int i=0; i<=9; i++){
if(letter[m]==1){
leds[i] = CRGB(255, 255, 255);
}
else{
leds[i] = CRGB(0, 0, 0);
}
FastLED.show();
m++;
}
delayMicroseconds(500);
}
}
Last edited by a moderator:
