Arduino HC06 Cannot turn on and off LED


hi guys,

  followed instruction arduino hc06. can use serial port ( com 3 ) turn on & off led sending command f or n @ arduino leonardo did. when connect hc06 teraterm ( bluetooth terminal ) , unable type command in after connected com port 5 ( incoming ). below connection hc06 , attached picture connection of arduino, led , blueeoth. unable turn on , off using bluetooth terminal @ laptop. somehow try android device , connect hc06 typing command f or n using bluetooth terminal apk cannot turn on , off.please help.



my tera term connection:
http://s30.postimg.org/x242xzav5/tera_term.png

hc06    microcontroller
tx    -> rx
rx    -> tx
gnd -> gnd
vcc ->  3.3v

extra: led -> pin 8

setting baud rate , etc : 9600, 1,none,0

code: [select]
char bluetoothval;           //value sent on 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 data being recieved
    bluetoothval=serial.read(); //read it
  }
  if (bluetoothval=='n')
  {//if value bluetooth serial n
    digitalwrite(13,high);            //switch on led
    if (lastvalue!='n')
      serial.println(f("led on")); //print led on
    lastvalue=bluetoothval;
  }
  else if (bluetoothval=='f')
  {//if value bluetooth serial n
    digitalwrite(13,low);             //turn off led
    if (lastvalue!='f')
      serial.println(f("led off")); //print led on
    lastvalue=bluetoothval;
  }
  delay(1000);
}

you make no mention of pairing bluetooth , pc.

you may have power problem. connected 3.3v, not enough. use 5v.


Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > Arduino HC06 Cannot turn on and off LED


arduino

Comments

Popular posts from this blog

invalid use of void expresion in FlexiTimer2 library

error: a function-definition is not allowed here before '{' token

LED Strip Code