B4R Question IR send and receive

Lee Ingram

Member
Licensed User
Longtime User
I want to send 38khz on pin 13, but line 7 does not seem to work. It only want 1 parameter.
How else can I do this?



B4X:
Private Sub AppStart

    Serial1.Initialize(115200)

    Log("AppStart")

    irsend.Enable(13,38) 'frequency = 38khz

    timer1.Initialize("timer1_Tick", 500)

    timer1.Enabled = True

End Sub
 

KiloBravo

Active Member
Licensed User
Read this post https://www.b4x.com/android/forum/threads/ir-send-and-receive.69454/#content

What module are you using ? There are two libraries. One for the esp8266 and one for an arduino.
The esp8266 library takes two parameters in the enable.

This code from the example works on my esp8266.

IRsend:
Sub Process_Globals
   Public Serial1 As Serial
   Private irsend As IrSend
   Private timer1 As Timer
   Public extras As ESP8266extras
   Public dpins As D1Pins
  
End Sub

Private Sub AppStart
   Serial1.Initialize(115200)
   Log("AppStart")
   irsend.Enable(dpins.D8,38)
  
  
   timer1.Initialize("timer1_Tick", 500)
   timer1.Enabled = True
End Sub

Sub Timer1_Tick
   Dim m As UInt = Bit.And(Millis, 0xfff) 'get 12 bits
   Log("sending: ", m)
   irsend.SendRC5(m, 12)
End Sub
 
Upvote 0

KiloBravo

Active Member
Licensed User
I am a little rusty myself. It took me 30 minutes to find the library on the forum, download and extract it, grab an esp8266,
create a new project, copy Erel's code, set up a test board, compile the program, and get it running on the hardware! :cool:
 
Upvote 0

Lee Ingram

Member
Licensed User
Longtime User
I am a little rusty myself. It took me 30 minutes to find the library on the forum, download and extract it, grab an esp8266,
create a new project, copy Erel's code, set up a test board, compile the program, and get it running on the hardware! :cool:
Thank you. I added the ESP8266extras library and tried it again. Everything is working perfectly, now.
 
Upvote 0
Top