B4R Question I cannot decode Infrared signal from remote control

hatzisn

Well-Known Member
Licensed User
Longtime User
Good morning everyone,

I am trying to use the libraries mentioned in this link for an infrared project :


Here is my schematic and connections and my code follows:

1616847776378.png


B4X:
Sub Process_Globals
    Public Serial1 As Serial
    Private wifi As ESP8266WiFi
    Private IRRecv As IrReceive
    Private d0 As Pin
    Private d1pins As D1Pins
End Sub

Private Sub AppStart
    Serial1.Initialize(9600)
    Log("AppStart")
    'example of connecting to a local network
'    If wifi.Connect2("SSID", "PASSWORD") Then
'        Log("Connected to network")
'    Else
'        Log("Failed to connect to network")
'    End If
   
    d0.Initialize(d1pins.D0, d0.MODE_INPUT)
   
    IRRecv.Initialize(d0.PinNumber, "IRRecv_Decoded")
   
End Sub


Sub IRRecv_Decoded (Result As IrResult)
    Log(Result.SONY)
End Sub

My problem as described in the title is that I cannot decode the signal - I get nothing. The receiver is a IR receiver LED and BLACK (not as seen in the picture grey). If I add a Looper to show the state of d0 pin (f.e. Log(d0.DigitalRead) I see some ones which means the led works ok. Any suggestions on what I am doing wrong?
 

janderkan

Well-Known Member
Licensed User
Longtime User
You should try to follow the example carefully.

B4X:
   Log("result: ", Result.DecodeType, ", ", Result.Value)
 
Upvote 0

hatzisn

Well-Known Member
Licensed User
Longtime User
Nothing changes. I get no result.
 
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
After
B4X:
IRRecv.Initialize(d0.PinNumber, "IRRecv_Decoded")

Add the line

B4X:
IRRecv.Enable
 
Last edited:
Upvote 0

hatzisn

Well-Known Member
Licensed User
Longtime User
Thank you all for answering.

The problem I suppose had to do with the state of the pin in WeMos D1 Mini R3. When I changed to the following setup (+ @Daestrum 's solution) everything worked ok. The negative pin (shorter) goes to 3,3V and the positive to D8 which has a 10K pulldown resistor (in the chip). Then it works:

1617894576681.png
 
Last edited:
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
Did you ever see this post @hatzisn???

 
Upvote 0

hatzisn

Well-Known Member
Licensed User
Longtime User
Did you ever see this post @hatzisn???


Thanks for answering. I have not seen this post but I already have achieved to get the signal from the remote control. I use a WeMos D1 mini R3 and this board does not have a PWM according to my knowledge. Further more I do not have an IR receptor with these pins but a LED like receptor as seen in my last post. Thanks anyway.
 
Upvote 0
Top