Using HC-06 Bluetooth Module and Sound Sensor at the same time

I am using and HC-06 Bluetooth module to control my RGB LED Light Strip through my phone. The program and Blynk connection for my Bluetooth control works perfectly. However, I am trying to implement a sound sensor into this project to sync the light strip with music. I have a program that works with the sound sensor by itself, but for some reason the sound sensor does not like being combined with Bluetooth. When I control the lights via bluetooth, the sound sensor is always activated. It works perfectly without the bluetooth module connected, but it never works when it is. I am using virtual pins and the ZERGBA to control the color of the light strip. I also have a virtual button to turn the lights on and off. This is all using an Arduino UNO and a Samsung Galaxy S10. Does anyone know what I am doing wrong with the sound sensor? Is there a way I could hook up the sound sensor with the bluetooth module and run smoothly? Is there a way I can code both the bluetooth control and sound control together using blynk? If so, please let me know. My code for my bluetooth control will be down below. Thank you.

#define BLYNK_PRINT Serial
#define redpin 11
#define greenpin 10
#define bluepin 9

#include <SoftwareSerial.h>
SoftwareSerial SwSerial(2, 3); // RX, TX
    
#include <BlynkSimpleSerialBLE.h>
#include <SoftwareSerial.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "UWSgcK9SzqntDRBUCEzWpZILqcdsaAwj";

SoftwareSerial SerialBLE(2, 3); // RX, TX

void setup()
{
  // Debug console
  Serial.begin(9600);

  SerialBLE.begin(9600);
  Blynk.begin(SerialBLE, auth);

  Serial.println("Waiting for connections...");
 
  pinMode(redpin, OUTPUT);
  pinMode(bluepin, OUTPUT);
  pinMode(greenpin, OUTPUT);
  digitalWrite(redpin, LOW);
  digitalWrite(greenpin, LOW);
  digitalWrite(bluepin, LOW);
}
BLYNK_WRITE(V0)
{
  
  analogWrite(redpin, param[0].asInt());
  analogWrite(greenpin, param[1].asInt());
  analogWrite(bluepin, param[2].asInt());
  
}
BLYNK_WRITE(V3)
{
  if (param.asInt()== 1)
  {
    analogWrite(greenpin, param[1].asInt());
    analogWrite(redpin, param[0].asInt());
    analogWrite(bluepin, param[2].asInt());
  
  }
 

  if (param.asInt()== 0)
  {
  analogWrite(redpin, 0);
  analogWrite(greenpin, 0);
  analogWrite(bluepin, 0);
  }
}







void loop()
{
  Blynk.run();
 
  // You can inject your own code or combine it with other sketches.
  // Check other examples on how to communicate with Blynk. Remember
  // to avoid delay() function!
}

@Trent_Terminie please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

What sort of sound sensor are you using, and how have you connected it?
What board are you using?
What types of widget are connected to V0 and V3 ?
What code did you add to try to get the sound sensor working?

Why do you have two SoftwareSerial ports declared, but only one used?

Pete.

1 Like

Use the concepts of intrupts that will helps the module to perform both the tasks diversely!So update your code and share it with us again!

Sir i need a Code ThaT controls the house lights using arduino mega with Bluetooth and sound sensor! Here I’m also sharing a code for it but i think there’s any problem in this code that is showing below because both the sensors working together so i can’t control the module as i wnt! Reply me asap!
Code:::::::
[Unformatted code removed by moderator]

@Ayaan_Apparrels I’ve removed your unformatted code from this the post in this topic. You’ve started another topic on exactly the same subject, and also posted the same code (also unformatted) in that topic.
Please edit your code in the other topic, and keep the conversation in one location.

Pete.

can we change the output ? From RGB LED to Bulb ? please reply this asap , sorry

An RGB bulb?

Pete.