I'm trying to decide my rf remote signals using ESP32 or node MCU. I have tried with Arduino and was successful but for some reason it is not working on either ESP32 or node MCU even using the same GPIO2 pin can anyone please tell me why both the boards are not able to decode the signal. I'm using the rc-switch library to decode and a 433Mhz transmitter reciever combo from amazon
RCSwitch mySwitch = RCSwitch();
void setup() {
Serial.begin(9600);
mySwitch.enableReceive(0); // Receiver on interrupt 0 => that is pin #2
}
void loop() {
if (mySwitch.available()) {
output(mySwitch.getReceivedValue(), mySwitch.getReceivedBitlength(), mySwitch.getReceivedDelay(), mySwitch.getReceivedRawdata(),mySwitch.getReceivedProtocol());
mySwitch.resetAvailable();
}
}```
-
Please include the wiring and your code into the question. You can edit it to add these information.chrisl– chrisl2021年04月29日 14:16:50 +00:00Commented Apr 29, 2021 at 14:16
-
Maybe it's related with 3.3V/5V difference?Michel Keijzers– Michel Keijzers2021年04月29日 14:17:23 +00:00Commented Apr 29, 2021 at 14:17
-
@chrisl I have also put up the coderohithrathod banoth– rohithrathod banoth2021年04月29日 14:30:55 +00:00Commented Apr 29, 2021 at 14:30
-
@MichelKeijzers I used the vin pin on both the boards which provide 5v and the reciever also works on 5v so I don't this that's the case and also I used the 5v pin on Arduino just to be surerohithrathod banoth– rohithrathod banoth2021年04月29日 14:32:50 +00:00Commented Apr 29, 2021 at 14:32
-
io 0 has a pull-up resistor because it is a boot config pin and on esp the interrupt pin numbers are the same as the labels on ocbJuraj– Juraj ♦2021年04月29日 15:05:17 +00:00Commented Apr 29, 2021 at 15:05
1 Answer 1
For ESP32, you should provide real GPIO number. For instance: mySwitch.enableReceive(13);
And without deep explanation, believe that it properly works
with GPIO 13 and 27.
Details you can find by google...
Explore related questions
See similar questions with these tags.