pov display with arduino

Thread Starter

Dabu WhiteHacker

Joined Sep 5, 2017
68
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

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);
}
}
Moderators note: copied code to forum
 
Last edited by a moderator:

dl324

Joined Mar 30, 2015
18,350
My browser says the site can't provide a secure connection. Post your code on this site, using code tags so any formatting is preserved.

Also kindly explain what you want the LEDs to do, and what they're doing.

POV has many definitions. I had to google to find out what POV meant in your context.
Point Of View is the most common usage.
upload_2018-7-3_7-35-17.png
 

MrChips

Joined Oct 2, 2009
34,850
"Porn On Video" or "Post Operative Vomiting" seem more applicable in this case?
Or is it "Peak Operating Voltage" since this is the most electrical?
 

dl324

Joined Mar 30, 2015
18,350
When used with display, I think Persistence Of Vision is more applicable; but I still had to google it.
 

OBW0549

Joined Mar 2, 2015
3,566
I refuse to play guessing games, and am opting for "Prostitutes On Video."

The OP could probably help us help him by describing exactly what his circuit is supposed to do, and what it is doing instead of doing what it is supposed to be doing. "Not working as it should" is not a very useful description.
 

dl324

Joined Mar 30, 2015
18,350
Code run through 'indent' and a some manual formatting on the character definitions:
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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, 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);
  }
}
 
Top