ESP8266 + LEDFader.h =?

Good evening, everyone! Please tell me how to adapt the library under esp8266 ???
On the Arduino Nano everything works well, but esp8266 Arduino Ide, gives a compile error!

#include <BlynkSimpleStream.h>
#include <LEDFader.h>
#define LED_PIN 3
char auth[] = "     ";
LEDFader led = LEDFader(3);
int Switch;
int SwitchState;
void setup()
{
 led.fade(0, 1000);
  Serial.begin(9600);
  Blynk.begin(auth, Serial);
} 
BLYNK_CONNECTED() {
  Blynk.syncAll();
}


BLYNK_WRITE(V1)
{
  Switch = param.asInt();
  if (Switch == HIGH)
  {
    SwitchState = !SwitchState;

    if (SwitchState)
    {
      led.fade(0, 1000);

    }
    else
    {
      led.fade(255, 1000);

    }
  }
}

void loop()
{
  Blynk.run();
  led.update();
}

Error Arduino IDE>>

Documents\Arduino\libraries\arduino-LEDFader-master\Curve.h:11:26: fatal error: avr/pgmspace.h: No such file or directory

#include <LEDFader.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "";
char ssid[] = "";
char pass[] = "";
#define LED_PIN 2
LEDFader led = LEDFader(2);
int Switch;
int SwitchState;
void setup()
{
 led.fade(255, 1000);
 Blynk.begin(auth, ssid, pass, IPAddress(192, 168, 1, 100));
 
}
BLYNK_WRITE(V1)
{
  Switch = param.asInt();
  if (Switch == HIGH)
  {
    SwitchState = !SwitchState;

    if (SwitchState)
    {
      led.fade(0, 1000);

    }
    else
    {
      led.fade(255, 1000);

    }
  }
}
void loop()
{
  Blynk.run();
  led.update();
}

Your error clearly shows the issue, No such file or directory and it is not directly Blynk related.

Make sure you have the LED Fader library properly installed.

AFAIK this means a library for an Atmel device. Suggest you look for a library that works with an Espressif device.

The library is installed correctly!
On the Arduino Nano everything works well
On esp8266 an error compiling!

In file included from C:\Users\Андрей\Documents\Arduino\libraries\arduino-LEDFader-master\Curve.cpp:8:0:

C:\Users\Андрей\Documents\Arduino\libraries\arduino-LEDFader-master\Curve.h:11:26: fatal error: avr/pgmspace.h: No such file or directory

 #include <avr/pgmspace.h>

                          ^

compilation terminated.

exit status 1
Ошибка компиляции для платы NodeMCU 1.0 (ESP-12E Module).

That’s because it has an Atmel chip, which the ESP doesn’t.

The library is NOT installed correctly… go back and read :wink:

Then follow @Costas advice, he knows much about ESP. Perhaps (even installed correctly) that library may not work on ESP?

C:\Users\Андрей\Documents\Arduino\libraries\LEDFader\Curve.h:11:26: fatal error: avr/pgmspace.h: No such file or directory

How to adapt LEDFader.h under Esp8266 ??
And is it possible at all ???
Or How can replace this library ???

This is Atmel’s proprietary memory management function.
Search the wider internet for a library that does the same thing as the Atmel library on an ESP.

1 Like
#include <LED.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = " ";
char ssid[] = " ";
char pass[] = " ";
LED led123 = LED(12);
int Switch ;
int SwitchState ;
void setup()
{
 Blynk.begin(auth, ssid, pass, IPAddress(192, 168, 1, 100)); 
} 
BLYNK_CONNECTED() {
  Blynk.syncAll();
}
BLYNK_WRITE(V1)
{
  Switch = param.asInt();
  if (Switch)
  {
    SwitchState = !SwitchState;

    if (SwitchState)
    {
      led123.fadeIn(2000);
      led123.setValue(255);
}
    if (SwitchState == LOW)
    {
      led123.fadeOut(2000);
      led123.setValue(0);
      
    }
  }
}
void loop()
{
  Blynk.run();
}

Well LED.h is an older library but it works (once one installs the updated version)… however it appears to be a blocking function (in my tests), thus not good for Blynk use, particularly for ESP as I understand they are picky about communication timing.

I corrected Curve.h in the library, now it should be loaded in esp8266 !!

/* 
 * File:   Curve.h
 * Author: cameron
 *
 * Created on October 22, 2013, 1:07 AM
 */

#ifndef CURVE_H
#define	CURVE_H

#if defined(ARDUINO) && ARDUINO >= 100
  #include "Arduino.h"
#else
  #include "WProgram.h"
#endif 

class Curve {
 static const uint8_t etable[] PROGMEM;
public:
 static uint8_t exponential(uint8_t);
 static uint8_t linear(uint8_t);
 static uint8_t reverse(uint8_t);
};

#endif	/* CURVE_H */

:grinning:

Does it work correctly now? I was actually getting ready to start a project using this library.

In my experience if you need to “hack” a library it doesn’t really get any better in the long run. I have no idea what that library does, but aren’t there alternatives that do work out of the box on the ESP?

everything is working ! checking code is not hampered today for blynk I think everything is OK

It works all day. normal flight