Why not RBDimmer Lib. not capable with Arduino Iot cloud

Hello everyone I am trying to add Rbdimmer in my project but i got an error can someone told me why this happens,

error while compile:

Arduino: 1.8.12 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled (new can abort), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

In file included from C:\Users\jamsa\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/Arduino.h:29:0,

                 from sketch\ESP8266_jul06a.ino.cpp:1:

C:\Users\jamsa\OneDrive\Documents\Arduino\libraries\RBDDimmer-master\src/RBDdimmer.h:32:11: error: 'OFF' redeclared as different kind of symbol

     OFF = false,

           ^

In file included from C:\Users\jamsa\OneDrive\Documents\Arduino\libraries\ArduinoIoTCloud\src/ArduinoIoTCloud.h:33:0,

                 from sketch\thingProperties.h:3,

                 from C:\Users\jamsa\OneDrive\Desktop\Arduino cloud My idea\ESP8266_jul06a - Copy\ESP8266_jul06a\ESP8266_jul06a.ino:2:

C:\Users\jamsa\OneDrive\Documents\Arduino\libraries\ArduinoIoTCloud\src/AIoTC_Const.h:26:19: error: previous declaration of 'const bool OFF'

 static bool const OFF = false;

                   ^

In file included from C:\Users\jamsa\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\cores\esp8266/Arduino.h:29:0,

                 from sketch\ESP8266_jul06a.ino.cpp:1:

C:\Users\jamsa\OneDrive\Documents\Arduino\libraries\RBDDimmer-master\src/RBDdimmer.h:33:10: error: 'ON' redeclared as different kind of symbol

     ON = true

          ^

In file included from C:\Users\jamsa\OneDrive\Documents\Arduino\libraries\ArduinoIoTCloud\src/ArduinoIoTCloud.h:33:0,

                 from sketch\thingProperties.h:3,

                 from C:\Users\jamsa\OneDrive\Desktop\Arduino cloud My idea\ESP8266_jul06a - Copy\ESP8266_jul06a\ESP8266_jul06a.ino:2:

C:\Users\jamsa\OneDrive\Documents\Arduino\libraries\ArduinoIoTCloud\src/AIoTC_Const.h:25:19: error: previous declaration of 'const bool ON'

 static bool const ON  = true;

                   ^

C:\Users\jamsa\OneDrive\Desktop\Arduino cloud My idea\ESP8266_jul06a - Copy\ESP8266_jul06a\ESP8266_jul06a.ino: In function 'void setup()':

ESP8266_jul06a:131:31: error: no matching function for call to 'dimmerLamp::begin(DIMMER_MODE_typedef, const bool&)'

   dimmer.begin(NORMAL_MODE, ON);

                               ^

C:\Users\jamsa\OneDrive\Desktop\Arduino cloud My idea\ESP8266_jul06a - Copy\ESP8266_jul06a\ESP8266_jul06a.ino:131:31: note: candidate is:

In file included from C:\Users\jamsa\OneDrive\Desktop\Arduino cloud My idea\ESP8266_jul06a - Copy\ESP8266_jul06a\ESP8266_jul06a.ino:3:0:

C:\Users\jamsa\OneDrive\Documents\Arduino\libraries\RBDDimmer-master\src/RBDdimmer.h:63:14: note: void dimmerLamp::begin(DIMMER_MODE_typedef, ON_OFF_typedef)

         void begin(DIMMER_MODE_typedef DIMMER_MODE, ON_OFF_typedef ON_OFF);

              ^

C:\Users\jamsa\OneDrive\Documents\Arduino\libraries\RBDDimmer-master\src/RBDdimmer.h:63:14: note:   no known conversion for argument 2 from 'const bool' to 'ON_OFF_typedef'

exit status 1
no matching function for call to 'dimmerLamp::begin(DIMMER_MODE_typedef, const bool&)'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

It's because 'ON' and 'OFF' are already defined in a library you're using.

In your sketch, rename all instances of 'OFF' to 'DISABLED' and all instances of 'ON' to 'ENABLED'. Or use some other variable names of your choice.

The hint is, it says, " ```
...previous declaration...

1 Like

Getting same kinds of error, after doing this

The issue is that these conflicting declarations exist in both the libraries you are using so you will have to modify the source of one of the libraries. Probably the easiest would be the RBDimmer library.

1 Like

Thank you so much for your support,
I am thinking same as you, but dear sir I don't know how to modify Rbdimeer lib header fir and which syntax or sentence I change.

#ifndef RBDDIMMER_H
#define RBDDIMMER_H

#include <stdlib.h>

#if   defined(ARDUINO_ARCH_AVR)
	#include "avr/RBDmcuAVR.h"
#elif defined(ARDUINO_ARCH_ESP32)
	#include "esp32/RBDmcuESP32.h"
#elif defined(ARDUINO_ARCH_ESP8266)
	#include "esp8266/RBDmcuESP8266.h"
#elif defined(ARDUINO_ARCH_SAMD)
	#include "samd/RBDmcuSAMD21.h"
#elif defined(ARDUINO_ARCH_SAM)
	#include "sam/RBDmcuSAM.h"
#elif defined(ARDUINO_ARCH_STM32F1)
	#include "stm32duino/STM32F1/RBDmcuSTM32F1.h"
#elif defined(ARDUINO_ARCH_STM32F4)
	#include "stm32duino/STM32F4/RBDmcuSTM32F4.h"
#else 
	#error "This library only supports boards with an AVR, ESP32, ESP8266, SAMD, SAM, STM32F1/F4 processor."
#endif

typedef enum
{
    NORMAL_MODE = 0,
    TOGGLE_MODE = 1
} DIMMER_MODE_typedef;

typedef enum
{
    OFF = false,
    ON = true
} ON_OFF_typedef;

#define ALL_DIMMERS 30

class dimmerLamp 
{         
    private:
        int current_num;
		int timer_num;
        bool toggle_state;
        int tog_current;
		
		void port_init(void);
		void timer_init(void);
		void ext_int_init(void);
		
    public:   
        uint16_t pulse_begin;
        int dimmer_pin;
        int tog_max;
        int tog_min;
		
#if !(defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_SAMD))
        int zc_pin;

        dimmerLamp(int user_dimmer_pin, int zc_dimmer_pin);
#else
		dimmerLamp(int user_dimmer_pin);
#endif
        void begin(DIMMER_MODE_typedef DIMMER_MODE, ON_OFF_typedef ON_OFF);
        void setPower(int power);
		int  getPower(void);
		void setState(ON_OFF_typedef ON_OFF);
        bool getState(void);
		void changeState(void);
        void setMode(DIMMER_MODE_typedef DIMMER_MODE);
        DIMMER_MODE_typedef getMode(void);
        void toggleSettings(int minValue, int maxValue);  
};

#endif

Here is the header file please can you tell me? Sir which line or sentace

Perhaps the lines that contain 'ON' and 'OFF'? You can use a search-and-replace in the text editor.

change

typedef enum
{
    OFF = false,
    ON = true
} ON_OFF_typedef;

to

typedef enum
{
    RBDIMMER_OFF = false,
    RBDIMMER_ON = true
} ON_OFF_typedef;

and then change all occurrences of ON and OFF in the rbdimmer.cpp file as well

EDIT: Just looked at the library and there are individual .h/.cpp files for each of the architectures. You will have to change all occurrences in all the files (or at least for the architecture you are using)

1 Like

Sorry for my late response, i really feel sorry for this,

but this sketch not working at all for me

What did you try? "Not working" is not a helpful description of a problem.

I did all the changes according to your instructions in every where in RMDdimmer lib

After this

I got error invalid lib

If you really want help, you will have to share your code and error messages. I can't see your PC screen from here or access the files on your PC :slight_smile:

Sure sir I will definitely share with you right now I am out of my office

Tomorrow at morning I will share all the details

Arduino: 1.8.12 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

In file included from D:\Adminstration\Upgreat\Arduino Server fAN\FANcontrol\Untitled_aug02a\Untitled_aug02a.ino:4:0:

C:\Users\jamsa\OneDrive\Documents\Arduino\libraries\RBDDimmer-master\src/RBDdimmer.h:63:53: error: 'RBDIMMER_ON_RBDIMMER_OFF' has not been declared

         void begin(DIMMER_MODE_typedef DIMMER_MODE, RBDIMMER_ON_RBDIMMER_OFF _typedef RBDIMMER_ON_RBDIMMER_OFF );

                                                     ^

C:\Users\jamsa\OneDrive\Documents\Arduino\libraries\RBDDimmer-master\src/RBDdimmer.h:63:87: error: expected ',' or '...' before 'RBDIMMER_ON_RBDIMMER_OFF'

         void begin(DIMMER_MODE_typedef DIMMER_MODE, RBDIMMER_ON_RBDIMMER_OFF _typedef RBDIMMER_ON_RBDIMMER_OFF );

                                                                                       ^

C:\Users\jamsa\OneDrive\Documents\Arduino\libraries\RBDDimmer-master\src/RBDdimmer.h:66:17: error: 'RBDIMMER_ON_RBDIMMER_OFF' has not been declared

   void setState(RBDIMMER_ON_RBDIMMER_OFF _typedef RBDIMMER_ON_RBDIMMER_OFF );

                 ^

C:\Users\jamsa\OneDrive\Documents\Arduino\libraries\RBDDimmer-master\src/RBDdimmer.h:66:51: error: expected ',' or '...' before 'RBDIMMER_ON_RBDIMMER_OFF'

   void setState(RBDIMMER_ON_RBDIMMER_OFF _typedef RBDIMMER_ON_RBDIMMER_OFF );

                                                   ^

exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Arduino: 1.8.12 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"

In file included from D:\Adminstration\Upgreat\Arduino Server fAN\FANcontrol\Untitled_aug02a\Untitled_aug02a.ino:4:0:

C:\Users\jamsa\OneDrive\Documents\Arduino\libraries\RBDDimmer-master\src/RBDdimmer.h:63:53: error: 'RBDIMMER_ON_RBDIMMER_OFF' has not been declared

         void begin(DIMMER_MODE_typedef DIMMER_MODE, RBDIMMER_ON_RBDIMMER_OFF _typedef RBDIMMER_ON_RBDIMMER_OFF );

                                                     ^

C:\Users\jamsa\OneDrive\Documents\Arduino\libraries\RBDDimmer-master\src/RBDdimmer.h:63:87: error: expected ',' or '...' before 'RBDIMMER_ON_RBDIMMER_OFF'

         void begin(DIMMER_MODE_typedef DIMMER_MODE, RBDIMMER_ON_RBDIMMER_OFF _typedef RBDIMMER_ON_RBDIMMER_OFF );

                                                                                       ^

C:\Users\jamsa\OneDrive\Documents\Arduino\libraries\RBDDimmer-master\src/RBDdimmer.h:66:17: error: 'RBDIMMER_ON_RBDIMMER_OFF' has not been declared

   void setState(RBDIMMER_ON_RBDIMMER_OFF _typedef RBDIMMER_ON_RBDIMMER_OFF );

                 ^

C:\Users\jamsa\OneDrive\Documents\Arduino\libraries\RBDDimmer-master\src/RBDdimmer.h:66:51: error: expected ',' or '...' before 'RBDIMMER_ON_RBDIMMER_OFF'

   void setState(RBDIMMER_ON_RBDIMMER_OFF _typedef RBDIMMER_ON_RBDIMMER_OFF );

                                                   ^

exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

RBDIMMER_OFF

is not the same as

RBDIMMER_ON_RBDIMMER_OFF 

(also true for the ON version). Does the library declare some sort of namespace? It seems like you just need to match up your constant variable names.

Sorry but I don't understand what you mean, I just change the on off variable into Rbdimeer-on and Rbdimeer offf in whole lib as you said sir

Problem Solved i make some changes in Dimmer LIb compile with zero errors

but after uploading

my esp8266 keep reseting

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 3664, room 16
tail 0
chksum 0xee
csum 0xee
v39c79d9b
~ld

ets Jan 8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 3664, room 16
tail 0
chksum 0xee
csum 0xee
v39c79d9b
~ld

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.