Hello!
im using arduino uno and hc-06.I connected hc-06 with uno and when its powered up the lights in uno and bluetooth module blink and i can well understand that when it is paired with my android.primarily im trying to light a led turning on and off using android app.while uploading programs the Rx suddenly blinks and stopped by.then while im trying to send command ,it does not have any effect.I used different apps and programs and changed the port for led but nothing happened.
heres my last code i used,
char val; // variable to receive data from the serial port
int ledpin = 7; // LED connected to pin 48 (on-board LED)
void setup() {
pinMode(ledpin, OUTPUT); // pin 48 (on-board LED) as OUTPUT
Serial.begin(9600); // start serial communication at 9600bps
}
void loop() {
if( Serial.available() ) // if data is available to read
{
val = Serial.read(); // read it and store it in 'val'
}
if( val == '1' ) // if 'H' was received
{
digitalWrite(ledpin, HIGH); // turn ON the LED
} else {
digitalWrite(ledpin, LOW); // otherwise turn it OFF
}
delay(100); // wait 100ms for next reading
}
i made an app at app inventor in that case.i attached an image of its block.
i used also apps from google play such as BlueLED(code was different),BlueTerm but did not work.
how can i solve this problem?
Thanks for your reply.till today i was busy with solving different problems in my arduino boards.at length i have understood many things about arduino.as i am new so it was troublesome to use the Arduino .
But now my poblem is about HC_06 bluetooth module.i am using arduino uno.I connected the hc-06 with arduino.while sending command from android it does not respond.i tried different apps for that but same result.im trying to control two gear motors by using android app.i finished developing an app but while trying to send command the motors does not work.I paired the hc-06 with my android mobile and when my android app gets connected with hc-06 it stop blinking so i can understand that hc-06 taking data but the motors are not responding.how can i solve this?if you have any question ,please let me know.i may have many errors as im not native english speaker.so sorry for that.
mitun:
finished developing an app but while trying to send command the motors does not work.I paired the hc-06 with my android mobile and when my android app gets connected with hc-06 it stop blinking so i can understand that hc-06 taking data but the motors are not responding.how can i solve this?
You might be asking the wrong question. What is not responding? The motors? The HC-06? Nothing you have said suggests there is anything wrong with the HC-06.
You have three problem areas
Communication between Android and HC-06. If the light stops blinking, goes solid and stays solid, you have established that
Communication between HC-06 and Arduino. You have not proven this. It may be a simple matter of getting the wires the right way round.
Response of motors to commands. This is a separate programming issue, not relevant to this discussion, and a possible impediment to proving item 2.
The link I posted addresses bluetooth, not motors. I suggest you prove the bluetooth first, and then ask about the motors - if you need to.
Thanks once again for your response.
According to three problems you mentioned i would like to say that,
1.Communication between Android and HC-06. If the light stops blinking, goes solid and stays solid, you have established that { YEAH.THAT HAPPENED.}
2. Communication between HC-06 and Arduino. You have not proven this. It may be a simple matter of getting the wires the right way round.
{HERE IS MY WAY OF WIRING :
Response of motors to commands. This is a separate programming issue, not relevant to this discussion, and a possible impediment to proving item 2.
{I SEEM MY PROBLEM IS HERE IN NUMBER 3.
here is my code: https://dl.dropboxusercontent.com/u/257366574/ardu111.txt
i attached an image of the block of my app that was made in MIT APP INVENTOR.There are 5 buttons which sends byte from 1 to gradually 5.
As i am new to arduino so i might have many errors in my code.but i hope you will have helped me to solve my problem.Please mention if there is any error in my code.should i change the BAUD rate? }
Thanks in advance.
Response of motors to commands. This is a separate programming issue, not relevant to this discussion, and a possible impediment to proving item 2.
I SEEM MY PROBLEM IS HERE IN NUMBER 3.
It might be #2. You still have not proven it isn't.
RxTx are kosher, but is the power? What sort of HC-06 is it? If your Bluetooth is on a JY-MCU board, 3.3v might not be enough. Read the notes. Read what it says on the back of the board. I can't comment on the motors but, since you are using hardware serial, you should be able to prove that section by sending commands from a PC terminal via USB.
Thanks for your help...i figured out where my problem is...thanks...
But i have another problem for programming.
heres the link: http://forum.arduino.cc/index.php?topic=230715.0
hoping your response.
thanks once again.