Arduino Code for Bluetooth modules

profilevirs_3

I am trying to do use two bluetooth modules to control an LEDs.  I am using HC05 as master and another as slave.  I can get the two bluetooth module to pair up and communicate with one another using a serial communication in the Arduino IDE.  Now what I want to do is to use a push pins to turn on and off an LEDs.  Here is my set up for the loop and void set up.  I attached also the code that I am using for the bluetooth.  

=============================================================

void loop() 

{

  if(digitalRead(left_arrow_pin) == HIGH)

  {

    // seems like left arrow button was pressed 

    // so we clear all the pixels first

    clear_all_pixels();

    

    // and then we show the left arrow

    left_arrow();

  }

  else if(digitalRead(right_arrow_pin) == HIGH)

  {

    // seems like right arrow button was pressed 

    // so we clear all the pixels first

    clear_all_pixels();

    

    // and then we show the right arrow

    right_arrow();

  }

  

  else if(digitalRead(stop_sign_pin) == HIGH)

  {

    // seems like stop sign button was pressed 

    // so we clear all the pixels first

    clear_all_pixels();

    

    // and then we show the stop sign

    stop_sign();

  }

 }

====================================================================

void setup() 

{

  //setting the button pins we defined above as inputs

  pinMode(left_arrow_pin, INPUT);

  pinMode(right_arrow_pin, INPUT);

  pinMode(stop_sign_pin, INPUT);

  

  //initializing the led strip

  strip.begin();

  strip.show();

 

}

 

 

  • 7 years ago
  • 20
Answer(1)

Purchase the answer to view it

blurred-text
NOT RATED
  • attachment
    arduino_master_slave_hc_05.zip
Bids(1)