Last active
May 16, 2020 10:50
-
-
Save jrmedd/5516863 to your computer and use it in GitHub Desktop.
Replace '#include "WProgram.h"' with this code to make libraries compatible with latest Arduino IDE.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if defined(ARDUINO) && ARDUINO >= 100 | |
#include "Arduino.h" | |
#else | |
#include "WProgram.h" | |
#endif | |
#include <Wire.h> | |
/*Replace #include "WProgram.h" with the above code to make compatible with | |
latest Arduino IDE.*/ |
@AlmamyAZ if still the problem exist,
try changing "Arduino.h" "WProgram.h"
to <Arduino.h> <WProgram.h>
, and removing
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
part from .cpp file
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi everyone , I've tried this tips , but I have the same problem with WProgram , can you help me ?
Thanks
the .h code
#ifndef LED_h
#define LED_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
class LED{
public:
LED(int);
LED(int,int,int,int);
void lightOnBaguette(int);
void lightOffBaguette();
void lightOnCadre(int);
void lightOffCadre();
private:
int ledBaguette; //variable membre pour segment LED Baguette
int ledCadre1; //variable membre pour segment LED Cadre
int ledCadre2;
int ledCadre3;
int ledCadre4;
int luminosite; //variable membre pour la luminosité
};
#endif
and the .cpp code
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "LED.h"
LED::LED(int baguette){
ledBaguette = baguette;
pinMode(ledBaguette, OUTPUT);
}
LED::LED( int cadre1, int cadre2, int cadre3, int cadre4){
ledCadre1 = cadre1;
ledCadre2 = cadre2;
ledCadre3 = cadre3;
ledCadre4 = cadre4;
pinMode(ledCadre1, OUTPUT);
pinMode(ledCadre2, OUTPUT);
pinMode(ledCadre3, OUTPUT);
pinMode(ledCadre4, OUTPUT);
}
void LED::lightOnBaguette(int luminosite){
analogWrite(ledBaguette,luminosite);
}
void LED::lightOnCadre(int luminosite){
analogWrite(ledCadre1,luminosite);
analogWrite(ledCadre2,luminosite);
analogWrite(ledCadre3,luminosite);
analogWrite(ledCadre4,luminosite);
}
void LED::lightOffBaguette(){
digitalWrite(ledBaguette,LOW);
}
void LED::lightOffCadre(){
digitalWrite(ledCadre1,LOW);
digitalWrite(ledCadre2,LOW);
digitalWrite(ledCadre3,LOW);
digitalWrite(ledCadre4,LOW);
}