Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Arduino HC06 Cannot turn on and off LED

Status
Not open for further replies.

WhyWhy

Member level 4
Joined
Mar 18, 2013
Messages
68
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,779
Hi Guys,

i followed the instruction from Arduino HC06. I can use serial port ( Com 3 ) to turn on & off the LED by sending the command f or n at Arduino Leonardo as what he did. But when i connect the HC06 with my TeraTerm ( Bluetooth Terminal ) , it unable to type any command in it after connected to COM port 5 ( Incoming ). Below is my connection to HC06 and i attached the picture connection of arduino, LED and Blueeoth. I unable to turn on and off using my bluetooth terminal at my laptop. Somehow i try with my Android device and connect it to the HC06 by typing the command f or n using bluetooth terminal apk also cannot turn on and off.Please Help.

**broken link removed**

My tera term connection:
**broken link removed**

HC06 Microcontroller
Tx -> RX
Rx -> TX
GND -> GND
VCC -> 3.3V

Extra: LED -> pin 8

Setting Baud rate and etc : 9600, 1,none,0

Code:
char blueToothVal;           //value sent over via bluetooth
char lastValue;              //stores last state of device (on/off)
 
void setup()
{
 Serial.begin(9600); 
 pinMode(13,OUTPUT);
}
 
 
void loop()
{
  if(Serial.available())
  {//if there is data being recieved
    blueToothVal=Serial.read(); //read it
  }
  if (blueToothVal=='n')
  {//if value from bluetooth serial is n
    digitalWrite(13,HIGH);            //switch on LED
    if (lastValue!='n')
      Serial.println(F("LED is on")); //print LED is on
    lastValue=blueToothVal;
  }
  else if (blueToothVal=='f')
  {//if value from bluetooth serial is n
    digitalWrite(13,LOW);             //turn off LED
    if (lastValue!='f')
      Serial.println(F("LED is off")); //print LED is on
    lastValue=blueToothVal;
  }
  delay(1000);
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top