B4R Question nodeMCU and rRCSwitch library

giggetto71

Active Member
Licensed User
Longtime User
Hi,
does any one have any experience of the rRCSwith library with NodeMCU? I have installed the lib without problems and compiled the RCSwitch-receive module from the example but cannot get the Sub rcs_Available fired. maybe I am connecting the wrong pin? Which one should I use on the NodeMCU and how should I configure it the enable receiver. I have tried:

rcs.enableReceive("rcs_Available",pp.D6)

but it does not work.
any idea?
thanks
 

giggetto71

Active Member
Licensed User
Longtime User
I forgot to paste the code...sorry
B4X:
#Region Project Attributes
    #AutoFlushLogs: True
    #CheckArrayBounds: True
    #StackBufferSize: 300
#End Region

Sub Process_Globals
    Public Serial1 As Serial
    Public rcs As RCSwitch
    Public pp As D1Pins
End Sub

Private Sub AppStart
    Serial1.Initialize(115200)
    Delay(1000)
    Log("AppStart")
    rcs.Initialize
    rcs.enableReceive("rcs_Available",pp.D6)
End Sub

private Sub rcs_Available()
    Log("Code: ", rcs.ReceivedCode)
    Log("Protocol: ", rcs.ReceivedProtocol)
    Log("Bit length: ", rcs.ReceivedBitLength)
    Log("Delay: ", rcs.ReceivedDelay)
    Log(" ")
    rcs.ResetAvailable
End Sub
 
Upvote 0

thetahsk

Active Member
Licensed User
Longtime User
I forgot to paste the code...sorry
B4X:
// check your receive pin
// from the header file
//Example: <code>
           //rcs.enableReceive("rcs_Available", rcs.WEMOS_Receivepin_1)
           //</code>
           static const int WEMOS_Receivepin_1   = 5;

           //Example: <code>
           //rcs.enableReceive("rcs_Available", rcs.WEMOS_Receivepin_2)
           //</code>
           static const int WEMOS_Receivepin_2   = 4;

           //Example: <code>
           //rcs.enableReceive("rcs_Available", rcs.WEMOS_Receivepin_3)
           //</code>
           static const int WEMOS_Receivepin_3   = 0;

           //Example: <code>
           //rcs.enableReceive("rcs_Available", rcs.WEMOS_Receivepin_4)
           //</code>
           static const int WEMOS_Receivepin_4   = 2;

           //Example: <code>
           //rcs.enableReceive("rcs_Available", rcs.WEMOS_Receivepin_5)
           //</code>
           static const int WEMOS_Receivepin_5   = 14;

           //Example: <code>
           //rcs.enableReceive("rcs_Available", rcs.WEMOS_Receivepin_6)
           //</code>
           static const int WEMOS_Receivepin_6   = 12;

           //Example: <code>
           //rcs.enableReceive("rcs_Available", rcs.WEMOS_Receivepin_7)
           //</code>
           static const int WEMOS_Receivepin_7   = 13;

           //Example: <code>
           //rcs.enableReceive("rcs_Available", rcs.WEMOS_Receivepin_8)
           //</code>
           static const int WEMOS_Receivepin_8   = 15;

and check the arduino example if they are working.
https://github.com/sui77/rc-switch
 
Upvote 0

giggetto71

Active Member
Licensed User
Longtime User
thanks...had no luck..
I have set
B4X:
rcs.enableReceive("rcs_Available",rcs.WEMOS_Receivepin_3)
and connected the receiver data pin to pin D3 but still nothing...
any clue?
 
Upvote 0

giggetto71

Active Member
Licensed User
Longtime User
it works now..at least it can read the transmitter driven by the same nodemcu. I would say it's ok now. probably I was just guessing there were some othere devices transmitting using 433 Mhz but maybe I was wrong..thanks
 
Upvote 0

Ilya G.

Active Member
Licensed User
Longtime User
it works now..at least it can read the transmitter driven by the same nodemcu. I would say it's ok now. probably I was just guessing there were some othere devices transmitting using 433 Mhz but maybe I was wrong..thanks
How do you solve this?
 
Upvote 0

giggetto71

Active Member
Licensed User
Longtime User
HI. At the end I eneded up connecting the RF receiver to the D5 pin.
RF.PNG


As for the SW initialization the code is:
B4X:
rcs.Initialize
rcs.enableReceive("rcs_Available",rcs.WEMOS_Receivepin_5)

In this way, any time the RF receiver senses something on the 433Mhz band it fires the event "rcs_Avaliable" and you can get the code received by using rcs.receivecode.
Hope it helps.
 
Upvote 0

candide

Active Member
Licensed User
i am also playing with RCSwith library and a wemos and i saw also reception totally stuck some times.
in fact receptor can be blocked by a transmitter part on same esp8266 when we don't transmit and if pin at interface is not locked.

normally we have a parameter to lock transmitter in original library, but it is not in B4R library.

In my case, with the pin locked to False when transmitter is not used i don't have issue on reception side.
 
Upvote 0
Top