Два скетча в один?

Старик Похабыч

★★★★★★★
14 Авг 2019
4,192
1,281
Москва
Как то так

C++:
#define REPLACE_FASTLED // пункт 0
#define COLOR_DEBTH 1   // пункт 1

#include "microLED.h"   // пункт 3
//#include <FastLED.h>
#include <SPI.h>
#include <SD.h>

#define NUM_LEDS 289
#define DATA_PIN 6
#define CHIPSET WS2811
#define CMD_NEW_DATA 1
#define BAUD_RATE 115200

File fxdata;
//CRGB leds[NUM_LEDS];
LEDdata leds[NUM_LEDS];// пункт 4

microLED strip(leds, NUM_LEDS, DATA_PIN);  // пункт 5
#define FastLED strip   // пункт 6

void setup()
{
   // пункт 7
//  FastLED.addLeds<CHIPSET, DATA_PIN>(leds, NUM_LEDS); //see doc for different LED strips
  Serial.begin(BAUD_RATE);

 
  for(int y = 0 ; y < NUM_LEDS ; y++)
  {
    leds[y] = BLACK; // set all leds to black during setup
  }
  FastLED.show();

  pinMode(10, OUTPUT); // CS/SS pin as output for SD library to work.
  digitalWrite(10, HIGH); // workaround for sdcard failed error...

  if (!SD.begin(4))
  {
    Serial.println("sdcard initialization failed!");
    return;
  }
  Serial.println("sdcard initialization done.");
 
  // test file open
  fxdata = SD.open("myanim.dat");  // read only
  if (fxdata)
  {
    Serial.println("file open ok");     
    fxdata.close();
  }
}

int serialGlediator ()
{
  while (!Serial.available()) {}
  return Serial.read();
}

void loop()
{

  fxdata = SD.open("myanim.dat");  // read only
  if (fxdata)
    {
      Serial.println("file open ok");     
    }

  while (fxdata.available())
  {
    fxdata.readBytes((char*)leds, NUM_LEDS*3);
    FastLED.show();
    delay(50); // set the speed of the animation. 20 is appx ~ 500k bauds
  }
 
  // close the file in order to prevent hanging IO or similar throughout time
  fxdata.close();
}
 

Старик Похабыч

★★★★★★★
14 Авг 2019
4,192
1,281
Москва
А на кой ляд половина. Нужен тот, что на 100 лампочек и работает. Если такого нет, то это вообще отдельная история. Выше был укзан скетч, 10 на 10 который работает. Прикрепи его к своему сообщению.

И еще "не работает" очень расплывчатое понятие. скетч точно компилируется и без ошибок. На нехватку памяти не ругается.
 

Алексей22

✩✩✩✩✩✩✩
25 Фев 2020
41
0
64
А на кой ляд половина. Нужен тот, что на 100 лампочек и работает. Если такого нет, то это вообще отдельная история. Выше был укзан скетч, 10 на 10 который работает. Прикрепи его к своему сообщению.

И еще "не работает" очень расплывчатое понятие. скетч точно компилируется и без ошибок. На нехватку памяти не ругается.
Доброго дня Хатабыч. Я понимаю что достал своей тупостью. В 28 посту была половина скетча я, этот пост отредактировал и вставил рабочий код
C++:
#include <FastLED.h>
#include <SPI.h>
#include <SD.h>

#define NUM_LEDS 100 // LED number
#define DATA_PIN 6    // your data arduino pin
#define CHIPSET WS2811  // your LED chip type
#define CMD_NEW_DATA 1
#define BAUD_RATE 500000  //if using Glediator via serial
unsigned char x = 10; // matrix x size
unsigned char y = 10; // matrix y size

#define COLOR_ORDER GRB
#define BRIGHTNESS  15

int count_files = 15;                                        // Количество файлов

File fxdata;
CRGB leds[NUM_LEDS];

int val;
void setup()
{
  FastLED.addLeds<CHIPSET, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.setBrightness(BRIGHTNESS);
 
 Serial.begin(BAUD_RATE); // when using Glediator via usb
  Serial.begin(115200);

  for(int y = 0 ; y < NUM_LEDS ; y++)
  {
    leds[y] = CRGB::Black; // set all leds to black during setup
  }
  FastLED.show();

  pinMode(10, OUTPUT); // CS/SS pin as output for SD library to work.
  digitalWrite(10, HIGH); // workaround for sdcard failed error...

  if (!SD.begin(4))
  {
    Serial.println("sdcard initialization failed!");
    return;
  }
  Serial.println("sdcard initialization done.");

  // test file open
  fxdata = SD.open("1.out");  // read only
  if (fxdata)
  {
    Serial.println("file open ok");
    fxdata.close();
  }
}

int serialGlediator ()
{
  while (!Serial.available()) {}
  return Serial.read();
}

void loop()
{

for(val = 1; val <= count_files; val++)
{


  fxdata = SD.open(String(val)+".out");  // read only
  if (fxdata)
    {
      Serial.println("file open ok");
    }

  while (fxdata.available())
  {
    fxdata.readBytes((char*)leds, NUM_LEDS*3);
    ledSort(4);  //1-4 possible, set your first LED's position. Change the number: 1=TL(top left),2=TR(top right),3=BL(bottom left),4=BR(bottom right)
     FastLED.show();
    delay(50); // set the speed of the animation. 20 is appx ~ 500k bauds
  }

  // close the file in order to prevent hanging IO or similar throughout time
  fxdata.close();
}
}
int ledSort (int modus) { //1=TL,2=TR,3=BL,4=BR, this function will rearrange the led array ;-)
    CRGB tmp[x];
    if(modus == 3 || modus == 4) {

    for(int i = 0; i < (y / 2);i++) {
        for(int j = 0; j < x;j++) {
        tmp[j] = leds[i * x + j];
        leds[i * x] = leds[(y - i - 1) * x];
        leds[(y - i - 1) * x] = tmp[j];
         }
        }
     }

//     if(modus == 1 || modus == 3) {
//       for(int i = 1; i < y; i = i + 2) {
//       for(int j = x; j > 0;j--) {
//        tmp[(x - j)] = leds[i * x + j - 1];
//          }
//           for(int j = 0; j < x;j++) {
//        leds[i * x + j] = tmp[j];
//        }
//       }
//
//      }


     if(modus == 2 | modus == 4) {
      for(int i = 0; i < y; i = i + 2) {
       for(int j = x; j > 0;j--) {
        tmp[(x - j)] = leds[i * x + j - 1];
          }
           for(int j = 0; j < x;j++) {
        leds[i * x + j] = tmp[j];
        }
       }

      }
     return 1;
 
}
после проверки на 100%

Хатабыч, вот что у меня получилось, после моего рукоблудства. На память не ругается, но читать записанные на микро SD эффекты с проги Glediator не хочет.
C++:
#define REPLACE_FASTLED // пункт 0
#define COLOR_DEBTH 1   // пункт 1

#include  <microLED.h>   // пункт 3
//#include <FastLED.h>
#include <SPI.h>
#include <SD.h>

#define NUM_LEDS 289 // LED number
#define DATA_PIN 6    // your data arduino pin
#define CHIPSET WS2811  // your LED chip type
#define CMD_NEW_DATA 1
#define BAUD_RATE 115200  //if using Glediator via serial
unsigned char x = 17; // matrix x size
unsigned char y = 17; // matrix y size

#define COLOR_ORDER GRB
#define BRIGHTNESS  15

int count_files = 15;                                        // Количество файлов

File fxdata;
//CRGB leds[NUM_LEDS];
LEDdata leds[NUM_LEDS];// пункт 4

microLED strip(leds, NUM_LEDS, DATA_PIN);  // пункт 5
#define FastLED strip   // пункт 6
                                                            // int val;
void setup()
{
  // пункт 7
// FastLED.addLeds<CHIPSET, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  Serial.begin(BAUD_RATE);                       //FastLED.setBrightness(BRIGHTNESS);



  for(int y = 0 ; y < NUM_LEDS ; y++)
  {
   leds[y] = BLACK;                   // leds[y] = CRGB::Black; // set all leds to black during setup
  }
  FastLED.show();

  pinMode(10, OUTPUT); // CS/SS pin as output for SD library to work.
  digitalWrite(10, HIGH); // workaround for sdcard failed error...

  if (!SD.begin(4))
  {
    Serial.println("sdcard initialization failed!");
    return;
  }
  Serial.println("sdcard initialization done.");

  // test file open
  fxdata = SD.open("myanim.dat");  // read only
  if (fxdata)
  {
    Serial.println("file open ok");
    fxdata.close();
  }
}

int serialGlediator ()
{
  while (!Serial.available()) {}
  return Serial.read();
}

void loop()
{

                                                  // for(val = 1; val <= count_files; val++)
                                            {


    fxdata = SD.open("myanim.dat");                                                 //fxdata = SD.open(String(val)+".out");  // read only
  if (fxdata)
    {
      Serial.println("file open ok");
    }

  while (fxdata.available())
  {
    fxdata.readBytes((char*)leds, NUM_LEDS*3);
                                                      // ledSort(4);  //1-4 possible, set your first LED's position. Change the number: 1=TL(top left),2=TR(top right),3=BL(bottom left),4=BR(bottom right)
     FastLED.show();
    delay(50); // set the speed of the animation. 20 is appx ~ 500k bauds
  }

  // close the file in order to prevent hanging IO or similar throughout time
  fxdata.close();
}
}
int ledSort (int modus) { //1=TL,2=TR,3=BL,4=BR, this function will rearrange the led array ;-)
LEDdata tmp[x];                                                  // CRGB tmp[x];
    if(modus == 3 || modus == 4) {

  for(int i = 0; i < (y / 2);i++) {
      for(int j = 0; j < x;j++) {
    tmp[j] = leds[i * x + j];
    leds[i * x] = leds[(y - i - 1) * x];
    leds[(y - i - 1) * x] = tmp[j];
       }
        }
     }

//     if(modus == 1 || modus == 3) {
//       for(int i = 1; i < y; i = i + 2) {
//       for(int j = x; j > 0;j--) {
//        tmp[(x - j)] = leds[i * x + j - 1];
//          }
//           for(int j = 0; j < x;j++) {
//      leds[i * x + j] = tmp[j];
//      }
//       }
//
//      }


     if(modus == 2 | modus == 4) {
      for(int i = 0; i < y; i = i + 2) {
       for(int j = x; j > 0;j--) {
        tmp[(x - j)] = leds[i * x + j - 1];
          }
           for(int j = 0; j < x;j++) {
      leds[i * x + j] = tmp[j];
      }
       }

      }
     return 1;

}
 

Старик Похабыч

★★★★★★★
14 Авг 2019
4,192
1,281
Москва
А теперь вопрос на засыпку: с чего ты решил, что формат данных, который записан на карту поддерживает размер 17 на 17 ? Если данные ограничены размером 10 на 10, то картинка будет содержать 100 пикселей. Натянуть на 17 на 17 можно, но не факт, что это реализовано.
второй момент. взял 1-ый рабочий скетч 10 на 10 и твой. получил одинаковое значение (ну почти памяти) и 5% разности в скетче. хотя должно быть одно и то же,
третий момент. Есть такая строка
#define BAUD_RATE 500000 //if using Glediator via serial
если это скорость чтения порта, то она нестандартная. в твоем скетче стоит 115200, в том, что в посте 36 500000.

На всякий случай прикладываю переделанный скетч из поста 36 на 17х17 микролед. Изменил в нем глубину цвета на 2, что больше чем 1, но меньше чем 3. т.е. цвета должны ближе к оригинальным
C++:
#define REPLACE_FASTLED // пункт 0
#define COLOR_DEBTH 2   // пункт 1

#include  <microLED.h>   // пункт 3
//#include <FastLED.h>
#include <SPI.h>
#include <SD.h>

#define NUM_LEDS 289 // LED number
#define DATA_PIN 6    // your data arduino pin
#define CHIPSET WS2811  // your LED chip type
#define CMD_NEW_DATA 1
#define BAUD_RATE 500000  //if using Glediator via serial
unsigned char x = 17; // matrix x size
unsigned char y = 17; // matrix y size

#define COLOR_ORDER GRB
#define BRIGHTNESS  15

int count_files = 15;                                        // Количество файлов

File fxdata;
//CRGB leds[NUM_LEDS];
LEDdata leds[NUM_LEDS];// пункт 4

microLED strip(leds, NUM_LEDS, DATA_PIN);  // пункт 5
#define FastLED strip   // пункт 6


int val;
void setup()
{
  //FastLED.addLeds<CHIPSET, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.setBrightness(BRIGHTNESS);
 
 Serial.begin(BAUD_RATE); // when using Glediator via usb
  Serial.begin(115200);

  for(int y = 0 ; y < NUM_LEDS ; y++)
  {
    leds[y] = BLACK; // set all leds to black during setup
  }
  FastLED.show();

  pinMode(10, OUTPUT); // CS/SS pin as output for SD library to work.
  digitalWrite(10, HIGH); // workaround for sdcard failed error...

  if (!SD.begin(4))
  {
    Serial.println("sdcard initialization failed!");
    return;
  }
  Serial.println("sdcard initialization done.");

  // test file open
  fxdata = SD.open("1.out");  // read only
  if (fxdata)
  {
    Serial.println("file open ok");
    fxdata.close();
  }
}

int serialGlediator ()
{
  while (!Serial.available()) {}
  return Serial.read();
}

void loop()
{

for(val = 1; val <= count_files; val++)
{


  fxdata = SD.open(String(val)+".out");  // read only
  if (fxdata)
    {
      Serial.println("file open ok");
    }

  while (fxdata.available())
  {
    fxdata.readBytes((char*)leds, NUM_LEDS*3);
    ledSort(4);  //1-4 possible, set your first LED's position. Change the number: 1=TL(top left),2=TR(top right),3=BL(bottom left),4=BR(bottom right)
     FastLED.show();
    delay(50); // set the speed of the animation. 20 is appx ~ 500k bauds
  }

  // close the file in order to prevent hanging IO or similar throughout time
  fxdata.close();
}
}
int ledSort (int modus) { //1=TL,2=TR,3=BL,4=BR, this function will rearrange the led array ;-)
    LEDdata tmp[x];
    if(modus == 3 || modus == 4) {

    for(int i = 0; i < (y / 2);i++) {
        for(int j = 0; j < x;j++) {
        tmp[j] = leds[i * x + j];
        leds[i * x] = leds[(y - i - 1) * x];
        leds[(y - i - 1) * x] = tmp[j];
         }
        }
     }

//     if(modus == 1 || modus == 3) {
//       for(int i = 1; i < y; i = i + 2) {
//       for(int j = x; j > 0;j--) {
//        tmp[(x - j)] = leds[i * x + j - 1];
//          }
//           for(int j = 0; j < x;j++) {
//        leds[i * x + j] = tmp[j];
//        }
//       }
//
//      }


     if(modus == 2 | modus == 4) {
      for(int i = 0; i < y; i = i + 2) {
       for(int j = x; j > 0;j--) {
        tmp[(x - j)] = leds[i * x + j - 1];
          }
           for(int j = 0; j < x;j++) {
        leds[i * x + j] = tmp[j];
        }
       }

      }
     return 1;
 
}
 

Алексей22

✩✩✩✩✩✩✩
25 Фев 2020
41
0
64
А теперь вопрос на засыпку: с чего ты решил, что формат данных, который записан на карту поддерживает размер 17 на 17 ? Если данные ограничены размером 10 на 10, то картинка будет содержать 100 пикселей. Натянуть на 17 на 17 можно, но не факт, что это реализовано.
второй момент. взял 1-ый рабочий скетч 10 на 10 и твой. получил одинаковое значение (ну почти памяти) и 5% разности в скетче. хотя должно быть одно и то же,
третий момент. Есть такая строка
#define BAUD_RATE 500000 //if using Glediator via serial
если это скорость чтения порта, то она нестандартная. в твоем скетче стоит 115200, в том, что в посте 36 500000.

На всякий случай прикладываю переделанный скетч из поста 36 на 17х17 микролед. Изменил в нем глубину цвета на 2, что больше чем 1, но меньше чем 3. т.е. цвета должны ближе к оригинальным
C++:
#define REPLACE_FASTLED // пункт 0
#define COLOR_DEBTH 2   // пункт 1

#include  <microLED.h>   // пункт 3
//#include <FastLED.h>
#include <SPI.h>
#include <SD.h>

#define NUM_LEDS 289 // LED number
#define DATA_PIN 6    // your data arduino pin
#define CHIPSET WS2811  // your LED chip type
#define CMD_NEW_DATA 1
#define BAUD_RATE 500000  //if using Glediator via serial
unsigned char x = 17; // matrix x size
unsigned char y = 17; // matrix y size

#define COLOR_ORDER GRB
#define BRIGHTNESS  15

int count_files = 15;                                        // Количество файлов

File fxdata;
//CRGB leds[NUM_LEDS];
LEDdata leds[NUM_LEDS];// пункт 4

microLED strip(leds, NUM_LEDS, DATA_PIN);  // пункт 5
#define FastLED strip   // пункт 6


int val;
void setup()
{
  //FastLED.addLeds<CHIPSET, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.setBrightness(BRIGHTNESS);

Serial.begin(BAUD_RATE); // when using Glediator via usb
  Serial.begin(115200);

  for(int y = 0 ; y < NUM_LEDS ; y++)
  {
    leds[y] = BLACK; // set all leds to black during setup
  }
  FastLED.show();

  pinMode(10, OUTPUT); // CS/SS pin as output for SD library to work.
  digitalWrite(10, HIGH); // workaround for sdcard failed error...

  if (!SD.begin(4))
  {
    Serial.println("sdcard initialization failed!");
    return;
  }
  Serial.println("sdcard initialization done.");

  // test file open
  fxdata = SD.open("1.out");  // read only
  if (fxdata)
  {
    Serial.println("file open ok");
    fxdata.close();
  }
}

int serialGlediator ()
{
  while (!Serial.available()) {}
  return Serial.read();
}

void loop()
{

for(val = 1; val <= count_files; val++)
{


  fxdata = SD.open(String(val)+".out");  // read only
  if (fxdata)
    {
      Serial.println("file open ok");
    }

  while (fxdata.available())
  {
    fxdata.readBytes((char*)leds, NUM_LEDS*3);
    ledSort(4);  //1-4 possible, set your first LED's position. Change the number: 1=TL(top left),2=TR(top right),3=BL(bottom left),4=BR(bottom right)
     FastLED.show();
    delay(50); // set the speed of the animation. 20 is appx ~ 500k bauds
  }

  // close the file in order to prevent hanging IO or similar throughout time
  fxdata.close();
}
}
int ledSort (int modus) { //1=TL,2=TR,3=BL,4=BR, this function will rearrange the led array ;-)
    LEDdata tmp[x];
    if(modus == 3 || modus == 4) {

    for(int i = 0; i < (y / 2);i++) {
        for(int j = 0; j < x;j++) {
        tmp[j] = leds[i * x + j];
        leds[i * x] = leds[(y - i - 1) * x];
        leds[(y - i - 1) * x] = tmp[j];
         }
        }
     }

//     if(modus == 1 || modus == 3) {
//       for(int i = 1; i < y; i = i + 2) {
//       for(int j = x; j > 0;j--) {
//        tmp[(x - j)] = leds[i * x + j - 1];
//          }
//           for(int j = 0; j < x;j++) {
//        leds[i * x + j] = tmp[j];
//        }
//       }
//
//      }


     if(modus == 2 | modus == 4) {
      for(int i = 0; i < y; i = i + 2) {
       for(int j = x; j > 0;j--) {
        tmp[(x - j)] = leds[i * x + j - 1];
          }
           for(int j = 0; j < x;j++) {
        leds[i * x + j] = tmp[j];
        }
       }

      }
     return 1;

}
Хатабыч, все что я там в коде на творил это не осознанное действие, это чисто дурная голова рукам покоя не дает. Попробовал я только что код который 17х17 не хочет он читать с флешки, грузится в ардуинку нормально но??????

Хатабыч, все что я там в коде на творил это не осознанное действие, это чисто дурная голова рукам покоя не дает. Попробовал я только что код который 17х17 не хочет он читать с флешки, грузится в ардуинку нормально но??????
Да и еще на ардуинке светодиод не моргает, а на рабочем коде моргает?
 

Старик Похабыч

★★★★★★★
14 Авг 2019
4,192
1,281
Москва
Возьми рабочий код 10 на 10. поменяй его под микролед и посмотри будет ли он работать. Если работает, то значит собака порылась в изменении размера. если нет, то задумка скетча несовместима с микролед
 

enemy_krs

★✩✩✩✩✩✩
28 Май 2019
104
37
Отладка что показывает? Карта инициализируется? Файл открывается?
 

Алексей22

✩✩✩✩✩✩✩
25 Фев 2020
41
0
64
Возьми рабочий код 10 на 10. поменяй его под микролед и посмотри будет ли он работать. Если работает, то значит собака порылась в изменении размера. если нет, то задумка скетча несовместима с микролед
Не работает, видать не судьба. Извини Хотабыч что напрягал, было приятно по общаться с умным человеком.
 
Изменено:

enemy_krs

★✩✩✩✩✩✩
28 Май 2019
104
37
Все работает, ещё раз ткни в рабочий код, посмотрю вывод
 

enemy_krs

★✩✩✩✩✩✩
28 Май 2019
104
37
В 28 посте скетч на фастлед, вы же переделывали на микролед, который из вариантов вы пытаетесь запустить?
 

enemy_krs

★✩✩✩✩✩✩
28 Май 2019
104
37
А скетч из 31 поста компилируется, что выводит в порт?
 

Старик Похабыч

★★★★★★★
14 Авг 2019
4,192
1,281
Москва
Тот файл. что ты переделывал сам почему то имеет закомменированные строки, поэтому он и меньше получился, 71-ая, 74-ая например
Но это не причина что бы не работал другой код.
Вот этот еще посмотри на всякий случай:
C++:
#define REPLACE_FASTLED // пункт 0
#define COLOR_DEBTH 3   // пункт 1

#include  <microLED.h>   // пункт 3
//#include <FastLED.h>
#include <SPI.h>
#include <SD.h>

#define NUM_LEDS 100 // LED number
#define DATA_PIN 6    // your data arduino pin
#define CHIPSET WS2811  // your LED chip type
#define CMD_NEW_DATA 1
#define BAUD_RATE 500000  //if using Glediator via serial
unsigned char x = 10; // matrix x size
unsigned char y = 10; // matrix y size

#define COLOR_ORDER GRB
#define BRIGHTNESS  15

int count_files = 15;                                        // Количество файлов

File fxdata;
//CRGB leds[NUM_LEDS];
LEDdata leds[NUM_LEDS];// пункт 4

microLED strip(leds, NUM_LEDS, DATA_PIN);  // пункт 5
#define FastLED strip   // пункт 6


int val;
void setup()
{
  //FastLED.addLeds<CHIPSET, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
  FastLED.setBrightness(BRIGHTNESS);

  Serial.begin(BAUD_RATE); // when using Glediator via usb
  Serial.begin(115200);

  for (int y = 0 ; y < NUM_LEDS ; y++)
  {
    leds[y] = BLACK; // set all leds to black during setup
  }
  FastLED.show();

  pinMode(10, OUTPUT); // CS/SS pin as output for SD library to work.
  digitalWrite(10, HIGH); // workaround for sdcard failed error...

  if (!SD.begin(4))
  {
    Serial.println("sdcard initialization failed!");
    return;
  }
  Serial.println("sdcard initialization done.");

  // test file open
  fxdata = SD.open("1.out");  // read only
  if (fxdata)
  {
    Serial.println("file open ok");
    fxdata.close();
  }
}

int serialGlediator ()
{
  while (!Serial.available()) {}
  return Serial.read();
}

void loop()
{

  for (val = 1; val <= count_files; val++)
  {


    fxdata = SD.open(String(val) + ".out"); // read only
    if (fxdata)
    {
      Serial.println("file open ok");
    }

    while (fxdata.available())
    {
      fxdata.readBytes((char*)leds, NUM_LEDS * 3);
      ledSort(4);  //1-4 possible, set your first LED's position. Change the number: 1=TL(top left),2=TR(top right),3=BL(bottom left),4=BR(bottom right)
      FastLED.show();
      delay(50); // set the speed of the animation. 20 is appx ~ 500k bauds
    }

    // close the file in order to prevent hanging IO or similar throughout time
    fxdata.close();
  }
}
int ledSort (int modus) { //1=TL,2=TR,3=BL,4=BR, this function will rearrange the led array ;-)
  LEDdata tmp[x];
  if (modus == 3 || modus == 4) {

    for (int i = 0; i < (y / 2); i++) {
      for (int j = 0; j < x; j++) {
        tmp[j] = leds[i * x + j];
        leds[i * x] = leds[(y - i - 1) * x];
        leds[(y - i - 1) * x] = tmp[j];
      }
    }
  }

  //     if(modus == 1 || modus == 3) {
  //       for(int i = 1; i < y; i = i + 2) {
  //       for(int j = x; j > 0;j--) {
  //        tmp[(x - j)] = leds[i * x + j - 1];
  //          }
  //           for(int j = 0; j < x;j++) {
  //        leds[i * x + j] = tmp[j];
  //        }
  //       }
  //
  //      }


  if (modus == 2 | modus == 4) {
    for (int i = 0; i < y; i = i + 2) {
      for (int j = x; j > 0; j--) {
        tmp[(x - j)] = leds[i * x + j - 1];
      }
      for (int j = 0; j < x; j++) {
        leds[i * x + j] = tmp[j];
      }
    }

  }
  return 1;

}
но и тут есть куски кода закрытые для исполнения, наверное так и надо
 

enemy_krs

★✩✩✩✩✩✩
28 Май 2019
104
37
я тут что то наговнокодил, пробуй

C++:
#define REPLACE_FASTLED // пункт 0
#define COLOR_DEBTH 2   // пункт 1
#define ORDER_RGB

#include <microLED.h>  // пункт 3
//#include <FastLED.h>
#include <SPI.h>
#include <SD.h>

#define NUM_LEDS 289
#define DATA_PIN 6 //проверить номер пина вывода на летну
//#define CHIPSET WS2811
#define CMD_NEW_DATA 1
//#define BAUD_RATE 115200

File fxdata;
LEDdata leds[NUM_LEDS];

microLED strip(leds, NUM_LEDS, DATA_PIN);

void setup()
{

  strip.setBrightness(30);
 
  for(int y = 0 ; y < NUM_LEDS ; y++)
  {
    leds[y] = RED; // set all leds to black during setup
  }
  strip.show();

  if (!SD.begin(10)) //!!!!!проверить куда подключен пин SD
  {
    //Serial.println("sdcard initialization failed!");
    return;
  }
  //Serial.println("sdcard initialization done.");
 
  // test file open
  /*fxdata = SD.open("myanim.dat");  // read only
  if (fxdata)
  {
    //Serial.println("file open ok");     
    fxdata.close();
  }*/
}

void loop()
{

  fxdata = SD.open("myanim.dat");  // read only
  if (fxdata)
    {
      //Serial.println("file open ok");     
    }

  while (fxdata.available())
  {
    strip.clear();
    fxdata.readBytes((char*)leds, NUM_LEDS*3);
    strip.show();
    delay(50);
  }
 
  fxdata.close();
}