Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glediator animations from SD card on ESP32 #886

Open
KaizenKuba opened this issue Sep 12, 2019 · 0 comments

Comments

@KaizenKuba
Copy link

commented Sep 12, 2019

Hello,
I try to run Glediator aminations from SD card on ESP32 and I have still error:

C:\Users\HP\Documents\Arduino\libraries\FastLED/FastLED.h:14:21: note: #pragma message: >FastLED version 3.003.000
pragma message "FastLED version 3.003.000"
In file included from C:\Users\HP\Documents\Arduino\libraries\FastLED/FastLED.h:65:0, from >D:\Arduino\GLEDIATOR TO >SD\Glediator_to_SD_z_forum_na_ESP\Glediator_to_SD_z_forum_na_ESP.ino:5:

C:\Users\HP\Documents\Arduino\libraries\FastLED/fastspi.h:130:23: note: #pragma message: No hardware SPI pins defined. All SPI access will default to bitbanged output

pragma message "No hardware SPI pins defined. All SPI access will default to bitbanged >output"

What should I do to run this code on ESP32? I'm new in programming. I use modified code for arduino UNO (on arduino UNO code works correctly):

`
#include <FastLED.h>
#include <SD.h>
#include <SPI.h>

#define NUM_LEDS 144
#define DATA_PIN 12
#define BAUD_RATE 1000000 //if using Glediator via serial
//#define MISO_PIN 19
//#define MOSI_PIN 24
//#define SCK_PIN 18
#define CS_PIN 5

File fxdata;
CRGB leds[NUM_LEDS];
//AltSoftSerial bluetooth;

void setup()
{
//begin serial
Serial.begin(9600);
Serial.println("SD Test");
//bluetooth.begin(9600);

//add leds
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
fill_solid(leds, NUM_LEDS, CRGB::Red);
FastLED.show();

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

//try to begin SPI coms
if (!SD.begin(CS_PIN))
{
Serial.println("sdcard initialization failed!");
return;
}
Serial.println("sdcard initialization done.");

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

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

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

//read and show
while (fxdata.available())
{
fxdata.readBytes((char*)leds, NUM_LEDS*3);
FastLED.show();
FastLED.delay(10); // 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();
}
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.