Jump to content
43oh

Bluetooth module HC-06 not w orking on launchpad


Recommended Posts

Hi im new on energia and im trying to recieve data from bluetooth by a HC-06 module conected to my launchpad (HardwareSerial) but i dont recieve anything, this is my code and neither green led or red led are turning on when i send data to it by my laptop or my smartphone. hope somebody can help me thanks :)

 

char incoming;
void setup()  
{
  // Open serial communications 
  Serial.begin(9600);
  pinMode(RED_LED,OUTPUT);
  digitalWrite(RED_LED,LOW);
    pinMode(GREEN_LED,OUTPUT);
  digitalWrite(GREEN_LED,LOW);

}

  
void loop() // run over and over
{
  
  if (Serial.available()){
    digitalWrite(GREEN_LED,HIGH);
    incoming= Serial.read();// read incoming char
    
    if(incoming=='a') //compare
    {
      digitalWrite(RED_LED,HIGH);
      delay(200);
    }
    else
    digitalWrite(RED_LED,LOW);
    delay(200);
    
  }
   else
    digitalWrite(GREEN_LED,LOW);
    delay(200);
  
  

}
Link to post
Share on other sites

 

Hi im new on energia and im trying to recieve data from bluetooth by a HC-06 module conected to my launchpad (HardwareSerial) but i dont recieve anything, this is my code and neither green led or red led are turning on when i send data to it by my laptop or my smartphone. hope somebody can help me thanks :smile:

 

char incoming;
void setup()  
{
  // Open serial communications 
  Serial.begin(9600);
  pinMode(RED_LED,OUTPUT);
  digitalWrite(RED_LED,LOW);
    pinMode(GREEN_LED,OUTPUT);
  digitalWrite(GREEN_LED,LOW);

}

  
void loop() // run over and over
{
  
  if (Serial.available()){
    digitalWrite(GREEN_LED,HIGH);
    incoming= Serial.read();// read incoming char
    
    if(incoming=='a') //compare
    {
      digitalWrite(RED_LED,HIGH);
      delay(200);
    }
    else
    digitalWrite(RED_LED,LOW);
    delay(200);
    
  }
   else
    digitalWrite(GREEN_LED,LOW);
    delay(200);
  
  

}

IT

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...