0

I can maybe work through a php/sql and css/html method of making a website to convert an image to code, but that is currently a time consuming method (which i will be taking the challenge if doing later on in life). I was wondering if there were any image to arduino code websites or software for apa102 led use. I saw persistanceofvisionproject.com but the code is in spanish and i really don’t understand it. If i did use that code I’m not sure what lines to take out assuming i don’t have a hall affect sensor. If you have any website or software that you know of, or you know how to fix this please let the community know.

Update: this is a pov didplay enter image description here And this is the spanish code website i was referring to, here. Maybe this will clear things up, im trying to get certain leds to light up precisely when spinning to make a replica of an image.

To run through my process lets take this image enter image description here using this URL I convert the image to LED POV view as seen here: enter image description here Now from here a code is generated as seen below

//PERSISTENCE OF VISION PROJECT
//AUTHOR: JES�S VICENTE PINPANPLOT@GMAIL.COM 2017
//Persistence of Vision Project by Jesús Vicente is licensed under a Creative Commons Reconocimiento 4.0 Internacional License.
/////////////////////////
//CONNECTIONS:
//////////////////////////
//HALL SENSOR IN D2 (RESISTOR 10K BETWEEN HALL SIGNAL AND HALL POSITIVE)
//ARDUINO NANO AND UNO: APA102 (or similar) 'DATA' TO MOSI (D11) AND 'CLOCK' TO SCK (D13) 
//ARDUINO MEGA: APA102 (or similar) 'DATA' TO MOSI (D51) AND 'CLOCK' TO SCK (D52)
//NOT CONNECT APA102 REVERSED!!! (POSIBLE DAMAGE)
//GND ARDUINO AND GND APA102 MUST BE CONNECTED
//POWER SUPPLY OF APA102 IS EXTERNAL FROM ARDUINO
//////////////////////////
//////////////////////////
const uint8_t chipled[] PROGMEM = {0};
const uint8_t numstrip[] PROGMEM = {1};
const uint8_t numradios[] PROGMEM = {1};
const uint8_t radio1directo[] PROGMEM = {1};
const uint8_t radio2directo[] PROGMEM = {1};
const uint8_t radio2180[] PROGMEM = {0};
const uint8_t offset1[] PROGMEM = {0};
const uint8_t offset2[] PROGMEM = {0};
const uint8_t brillo[] PROGMEM = {128};
const uint8_t animate[] PROGMEM = {0};
const uint8_t num_leds[] PROGMEM = {14};
const uint16_t numpasos[] PROGMEM = {60};
const uint16_t angreducido[] PROGMEM = {61};
const uint16_t sizePolarRedu[] PROGMEM = {234};
const uint8_t PolarRedu[234] PROGMEM = {0,1,4,0,2,4,0,3,4,0,4,4,0,5,4,0,6,4,0,7,4,0,8,1,0,9,1,0,10,1,0,11,1,0,12,1,0,13,1,0,14,1,8,8,4,10,9,4,13,9,1,15,8,1,18,7,1,21,6,1,29,5,1,35,10,4,44,9,4,50,11,4,52,8,4,58,5,4,59,7,4,61,6,4,62,12,4,75,13,4,93,14,4,103,14,1,121,9,1,122,10,1,123,13,1,126,8,1,130,11,1,135,12,1,142,6,1,142,7,1,164,6,4,172,7,4,176,8,4,186,8,1,191,7,1,200,6,1,220,6,4,220,7,4,225,12,4,233,11,4,234,8,4,234,11,1,235,11,4,235,13,4,240,10,4,241,9,4,242,9,1,243,9,4,253,14,4,254,14,1,255,14,4,20,14,1,33,13,1,44,6,1,44,12,1,46,7,1,48,5,1,51,8,1,57,11,1,61,9,1,70,10,1,73,5,4,82,6,4,87,7,4,90,8,4,92,9,4,96,9,1,97,8,1};
#include <avr/pgmspace.h>
#include "FastLED.h"
CRGB leds[141];
int angulo;
unsigned int numled;
unsigned int k = 0;
bool pasa = false;
bool cambiaLed = false;
long tiempoDibujo = 0;
long periodo = 0;
long periodoini = 0;
long previoustime = 0;
long tiempo = 0;
long contaseconds = 0;
unsigned int ang = 360;
long tvariable = 0;
int tiempoescritura = 700;
byte LedColour = 0;
byte vred = 0;
byte vgreen = 0;
byte vblue = 0;
int angAux = 0;
int anginicio = 360;
int kinicial = 0;
int contaang = 0;
long tiempoanimate = 0;
void setup() {
//Para resetear
pinMode(A2, INPUT);
digitalWrite(A2, LOW);
FastLED.addLeds<APA102>(leds, pgm_read_byte(num_leds + 0) + pgm_read_byte(offset1 + 0));
FastLED.setBrightness(pgm_read_byte(brillo + 0));
attachInterrupt(digitalPinToInterrupt(2), pasaIman, RISING);
memset(leds, 0, 141*3);
FastLED.show();
}
void loop() {
if (pasa == true) {
pasa = false;
tiempo = micros();
periodoini = tiempo - previoustime;
periodo = tiempo - previoustime - tvariable ;
//periodo teorico
tiempoDibujo = periodo / 360;
if (tiempoDibujo < 0) tiempoDibujo = 0;
previoustime = tiempo;
k = 0;
angulo = pgm_read_byte(PolarRedu + k);
if (k / 3 >= pgm_read_word_near(angreducido + 0)) {
angulo += 255;
};
contaang=0;
for (ang = 0; ang < 360 ; ang++) {
contaang++;
cambiaLed = false;
while (angulo == ang) {
cambiaLed = true;
if (pgm_read_byte(radio1directo + 0) == 1) {
numled = pgm_read_byte(PolarRedu + k+1) - 1 + pgm_read_byte(offset1 + 0);
} else {
//inverso es cero
numled = pgm_read_byte(num_leds + 0) - pgm_read_byte(PolarRedu + k+1) + pgm_read_byte(offset1 + 0);
}
LedColour = pgm_read_byte(PolarRedu + k+2);
//color option 0
vred = 0;
vgreen = 0;
vblue = 0;
if (LedColour == 4 || LedColour == 6 || LedColour == 7 || LedColour == 1) {
vblue = 255;
}
if (LedColour == 3 || LedColour == 5 || LedColour == 6 || LedColour == 1) {
vgreen = 255;
}
if (LedColour == 2 || LedColour == 5 || LedColour == 7 || LedColour == 1) {
vred = 255;
}
leds[numled].r = vred;
leds[numled].g = vgreen;
leds[numled].b = vblue;
k += 3;
if (k >= pgm_read_word_near(sizePolarRedu + 0)) {
angulo = 999;
}else{
angulo = pgm_read_byte(PolarRedu + k);
if (k / 3 >= pgm_read_word_near(angreducido + 0)) {
angulo += 255;
}
}
}
if (cambiaLed == true) {
FastLED.show();
if (tiempoDibujo > tiempoescritura) {
delayMicroseconds(tiempoDibujo - tiempoescritura);
}
} else {
if (tiempoDibujo > tiempoescritura) {
delayMicroseconds(tiempoDibujo + tiempoescritura * pgm_read_word_near(numpasos + 0) / (360 - pgm_read_word_near(numpasos + 0)));
} else {
delayMicroseconds(tiempoDibujo * 360 / (360 - pgm_read_word_near(numpasos + 0)));
}
}
if (pasa == true) {
//para que se sume a tvariable algo que se supone positivo
tvariable += (micros() - previoustime) * 360 /contaang - periodoini;
if (tvariable > 500000 || tvariable < -500000) {
tvariable = 0;
}
return;
}
}
//para que se sume a tvariable algo negativo
tvariable += (micros() - previoustime) - periodoini;
if (tvariable > 500000 || tvariable < -500000) {
tvariable = 0;
}
}
}
void pasaIman () {
pasa = true;
};

how can i run this code without a hall effect sensor on D2 and then convert the rest of the code to readable english

  • Are you asking, how you can get an image from your PC onto the Arduino to get shown on the POV display? – chrisl May 7 at 6:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.