Hello smart people ,
I have paired two HC05 together 1 as a master and the other as a slave i have a programming question. I want to push a button from the master arduino to make an LED Turn on on the other slave Arduino.
I the two arduino's are already paired only issue i have is programming issue.
Here is my Master Sketch:
const int ledPin = 42; // choose the pin for the LED
const int inputPin = 46; // choose the input pin (for a pushbutton)
void setup() {
pinMode(ledPin, OUTPUT); // declare LED as output
pinMode(inputPin, INPUT); // declare pushbutton as input
Serial.begin(38400);
}
void loop(){
int val = digitalRead(inputPin); // read input value
if (val == HIGH) // check if the input is HIGH
{
Serial.write('1');Â
}
else
{
Serial.write('0');Â
}
}
In the above code i have the switch debounce bug that I could not fix.
Here is the Slave-code:
int LED = 7;
int Recieved;
void setup() {
 // put your setup code here, to run once:
pinMode(LED, OUTPUT);
Serial.begin(38400);
}
void loop() {
 // put your main code here, to run repeatedly:
if(Serial.available() > 0){ // Checks whether data is comming from the serial port
  Recieved = Serial.read(); // Reads the data from the serial port
}
if (Recieved = '1')
{
 Serial.println('9');
 digitalWrite(LED,LOW);Â
}
if (Recieved = '0')
{
 Serial.println('8');
 digitalWrite(LED,HIGH);Â
}
I do not know why it is not receiving data from the master HC-05 even though the two devices are paired. Also I would really appreciate it if anyone can help me solve the switch debounce problem.