New blynk Codes related Error

i am trying to control 4 channel module in the new blynk platform:

Hardware Part:

  • ESP-32
  • 4 Channel Relay Module
  • IR Sensor

so here is my coding part

        void ir_remote(){
      if (irrecv.decode(&results)) {
          switch(results.value){
              case 0xFFB04F:  
                digitalWrite(RelayPin1, toggleState_1);
                toggleState_1 = !toggleState_1;
                Blynk.virtualWrite(VPIN_BUTTON_1, toggleState_1);
                delay(100);            
                break;
              case 0xFF9867:  
                digitalWrite(RelayPin2, toggleState_2);
                toggleState_2 = !toggleState_2;
                Blynk.virtualWrite(VPIN_BUTTON_2, toggleState_2);
                delay(100);            
                break;
              case 0xFFD827:  
                digitalWrite(RelayPin3, toggleState_3);
                toggleState_3 = !toggleState_3;
                Blynk.virtualWrite(VPIN_BUTTON_3, toggleState_3);
                delay(100);            
                break;
              case 0xFF807F:  
                digitalWrite(RelayPin4, toggleState_4);
                toggleState_4 = !toggleState_4;
                Blynk.virtualWrite(VPIN_BUTTON_4, toggleState_4);
                delay(100);            
                break;
                case 0xFF906F:  all_SwitchOff(); Blynk.virtualWrite(VPIN_BUTTON_9, toggleState_5); break;
                case 0xFFC03F:  all_SwitchOn();  Blynk.virtualWrite(VPIN_BUTTON_10, toggleState_5); break;
    default : break;  
       }     
            }   
            //Serial.println(results.value, HEX);    
            irrecv.resume();   
      } 
}

but this part is in blynk edgent header file

and i am getting a error

Arduino: 1.8.12 (Windows 10), Board: “ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None”

In file included from C:\Users\jamsa\OneDrive\Desktop\updated version\tech study cell\Code_ESP32_Blynk2_IR_DHT11_LDR_8Relays_Switch\Code_ESP32_Blynk2_IR_DHT11_LDR_8Relays_Switch\Code_ESP32_Blynk2_IR_DHT11_LDR_8Relays_Switch.ino:85:0:

sketch\BlynkEdgent.h: In function ‘void ir_remote()’:

BlynkEdgent.h:215:43: error: ‘all_SwitchOff’ was not declared in this scope

         case 0xFF906F:  all_SwitchOff(); Blynk.virtualWrite(VPIN_BUTTON_9, toggleState_5); dimmer.setState(OFF); break;

                                       ^

BlynkEdgent.h:216:42: error: ‘all_SwitchOn’ was not declared in this scope

         case 0xFFC03F:  all_SwitchOn();  Blynk.virtualWrite(VPIN_BUTTON_10, toggleState_5); dimmer.setState(ON); break;

                                      ^

Multiple libraries were found for “IRremote.h”
Used: C:\Users\jamsa\OneDrive\Documents\Arduino\libraries\IRremote
Not used: C:\Users\jamsa\OneDrive\Documents\Arduino\libraries\Arduino-IRremote-master
Multiple libraries were found for “BlynkSimpleEsp32_SSL.h”
Used: C:\Users\jamsa\OneDrive\Documents\Arduino\libraries\Blynk
Not used: C:\Program Files (x86)\Arduino\libraries\Blynk
Multiple libraries were found for “WiFi.h”
Used: C:\Users\jamsa\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\WiFi
Not used: C:\Program Files (x86)\Arduino\libraries\WiFi
Not used: C:\Users\jamsa\OneDrive\Documents\Arduino\libraries\WiFiNINA
exit status 1
‘all_SwitchOff’ was not declared in this scope

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

I already did it in edgent file

void all_SwitchOff(){
  toggleState_1 = 0; digitalWrite(RelayPin1, HIGH); Blynk.virtualWrite(VPIN_BUTTON_1, toggleState_1); delay(100);
  toggleState_2 = 0; digitalWrite(RelayPin2, HIGH); Blynk.virtualWrite(VPIN_BUTTON_2, toggleState_2); delay(100);
  toggleState_3 = 0; digitalWrite(RelayPin3, HIGH); Blynk.virtualWrite(VPIN_BUTTON_3, toggleState_3); delay(100);
  toggleState_4 = 0; digitalWrite(RelayPin4, HIGH); Blynk.virtualWrite(VPIN_BUTTON_4, toggleState_4); delay(100);
}

void all_SwitchOn(){
  toggleState_1 = 0; digitalWrite(RelayPin1, toggleState_1); Blynk.virtualWrite(VPIN_BUTTON_1, toggleState_1); delay(100);
  toggleState_2 = 0; digitalWrite(RelayPin2, toggleState_2); Blynk.virtualWrite(VPIN_BUTTON_2, toggleState_2); delay(100);
  toggleState_3 = 0; digitalWrite(RelayPin3, toggleState_3); Blynk.virtualWrite(VPIN_BUTTON_3, toggleState_3); delay(100);
  toggleState_4 = 0; digitalWrite(RelayPin4, toggleState_4); Blynk.virtualWrite(VPIN_BUTTON_4, toggleState_4); delay(100);
 
}

You need to clarify exactly what these two statements mean.

Pete.

It means when I press on button (ir) my all relay will goes off and when I press off button (ir) my all relay goes off

Hey there. Check this out :

1 Like

Same problem in this project not control all relays with ir remote buttons

So you want to control all relays simultaneously using one remote button right ?

Yahhh you are right

Any idea

Okay buddy.

Download the code, Go to the blynkedgent.h, you will find void ir_remote() like this :


Add another case then add all buttons without break, something like this :

case 0x00000000 :  
            digitalWrite(RelayPin1, toggleState_1);
            toggleState_1 = !toggleState_1;
            Blynk.virtualWrite(VPIN_BUTTON_1, toggleState_1);
            delay(100);            
           
            digitalWrite(RelayPin2, toggleState_2);
            toggleState_2 = !toggleState_2;
            Blynk.virtualWrite(VPIN_BUTTON_2, toggleState_2);
            delay(100);            
            
            digitalWrite(RelayPin3, toggleState_3);
            toggleState_3 = !toggleState_3;
            Blynk.virtualWrite(VPIN_BUTTON_3, toggleState_3);
            delay(100);            

etc…
You got the idea.
Try and let me know if it works.

This statement makes no sense in the context of your original post in this topic.
Your compiler error is because one part of the sketch can’t see the other part, which is why I said…

How to solve that compiler error depends on exactly where you’ve put the two snippets of code that you posted. Without that information I can’t really help.

Pete.

I am trying this but in my case I want to control all relays with one single remote button

Were you able to fix this? I’m having similar problems getting the code from the video above (which is excellent and elegant) to compile correctly.

I’m new to this and would appreciate any help.


                 from C:\temp\Arduino Sketches KM\8ch relays esp32\8ch_kam_b4\8ch_kam_b4.ino:38:

C:\temp\Arduino Sketches KM\libraries\IRremote\src/IRReceive.cpp.h:1373:6: note: declared here

 bool IRrecv::decode(decode_results *aResults) {

      ^~~~~~

Multiple libraries were found for "WiFi.h"

 Used: C:\Users\Gandalf\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\libraries\WiFi

 Not used: C:\Program Files (x86)\Arduino\libraries\WiFi

Multiple libraries were found for "IRremote.h"

 Used: C:\temp\Arduino Sketches KM\libraries\IRremote

 Not used: C:\Program Files (x86)\Arduino\libraries\IRremote-3.6.1

Using library Blynk at version 1.0.1 in folder: C:\temp\Arduino Sketches KM\libraries\Blynk 

Using library WiFi at version 2.0.0 in folder: C:\Users\Gandalf\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\libraries\WiFi 

Using library DHT_sensor_library at version 1.4.3 in folder: C:\temp\Arduino Sketches KM\libraries\DHT_sensor_library 

Using library IRremote at version 3.3.0 in folder: C:\temp\Arduino Sketches KM\libraries\IRremote 

Using library WiFiClientSecure at version 2.0.0 in folder: C:\Users\Gandalf\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\libraries\WiFiClientSecure 

Using library Preferences at version 2.0.0 in folder: C:\Users\Gandalf\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\libraries\Preferences 

Using library WebServer at version 2.0.0 in folder: C:\Users\Gandalf\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\libraries\WebServer 

Using library DNSServer at version 2.0.0 in folder: C:\Users\Gandalf\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\libraries\DNSServer 

Using library Update at version 2.0.0 in folder: C:\Users\Gandalf\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\libraries\Update 

Using library Ticker at version 2.0.0 in folder: C:\Users\Gandalf\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\libraries\Ticker 

Using library HTTPClient at version 2.0.0 in folder: C:\Users\Gandalf\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\libraries\HTTPClient 

Using library Adafruit_Unified_Sensor at version 1.1.5 in folder: C:\temp\Arduino Sketches KM\libraries\Adafruit_Unified_Sensor 

Using library FS at version 2.0.0 in folder: C:\Users\Gandalf\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.3\libraries\FS 

exit status 1

Error compiling for board ESP32-WROOM-DA Module.

@DearLordTheresAFire you appear to have omitted some of the compiler error messages, and it’s always good practice to start with the first errors that are reported by the compiler and begin diagnosing the problem from there.

Also, when you’re posting compiler output like this, it’s always best to put triple backticks before and after the compiler output so that it displays in a much more readable format.

Please edit your post, using the pencil icon at the bottom, and paste the full compiler output with triple backticks at the beginning and end so that it displays correctly.
Triple backticks look like this:
```

Pete.

Thank you Pete… That was helpful. Google lead me here so I’ll share what I did to fix this problem. The particular code involved was written to include it’s own Wifi routine. I started by returning to the source code, then adding only a few lines at a time until it wouldn’t compile any longer. It turned out to be that since the code had the Wifi written into it, my adding #include<Blynk.Simple32esp.h> was causing the crash. I needed to un-comment the “define wrover” so that it was enabled in the source code, and comment out the addition of the Blynk.Simple32 routine which I believed I needed to add (came from the wifi example in the Arduino IDE.)

I am new to this, and hope this thread and the solution helps another newbie just learning these ropes. My device is now connected. It only took about a week to get this stuff figured.

Off to map Virtual and hard pins (they are different, newbies. You don’t need a Virtual Pin for every Digital pin. Good to know.

Regards and thanks again,
DLTAF

It sounds like you’re using the Edgent example sketch.
If so, this needs no WiFi code or additional includes such as #include<Blynk.Simple32esp.h> because his is already handled within the example sketch.

Virtual pins and physical pins serve totally different purposes. You can use virtual pins to control physical pins if needed, as described here…

Pete.

Thank you again, Sir.

I was attempting to use the code posted by the maker of the video above. It has all the wifi it needs :slight_smile: No need to add anything folks. Lol.

I will review the primer you wrote as that does appear to be right about where my ‘let’s learn this stuff’ attempt to gather what I needed, to succeed now at my ‘hello world’ efforts at making an ESP32 work with Blynk2.0 and run 8 relays.

Time to add a bit more code and I do appreciate all the help, Pete. Truly,
DLTAF