Skip to content

[ESP32] Cannot use IRSend along with BLE #1031

@Make-It-Racing

Description

@Make-It-Racing

Device used:

ESP32 (nodemcu-32s) with Arduino framework

Version/revision of the library used

v2.7.2

I can send IR codes from my ESP32 very reliably using this code:

void loop() {
        unsigned long t1 = micros(), t2;
        irsend.sendSony(0x9999, 16, 2);  
        delay(1000);  
        t2 = micros();  
        Serial.printf("round of ir takes %ld micros\n", (t2 - t1));          
    }

it works very good with all the following libraries imported:

#include <Arduino.h>  
#include <BLE2902.h>  
#include <BLEDevice.h>  
#include <BLEServer.h>  
#include <BLEUtils.h>  
#include <IRrecv.h>  
#include <IRremoteESP8266.h>  
#include <IRsend.h>  
#include <IRutils.h>

IRsend is defined in my code as a global variable:
IRsend irsend(18); (using pin D18)

and my setup() method looks like this [relevant code only...]

void setup() {
    Serial.begin(38400);
    pinMode(LED_BUILTIN, OUTPUT);
    digitalWrite(LED_BUILTIN, LOW);
    // BLEDevice::init(NAMESTRING);

   /*
   ... 
   more commented out BLE code
   ...
   */

  irsend.begin();
}

this code (with the BLEDevice::init commented out) runs perfectly without any issues.
as soon as I un-comment this line, I cannot seem to send my IR codes in a reliable fashion. (meaning that on average about 5-10% of the times the code is sent correctly, but most of the times garbage values are seems to be sent.)

To check myself for receiving the correct codes, I use multiple Arduinos and ESP32 with several types of receivers (all work on 38 KHz).

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions