Go Down

Topic: HC-06 Bluetooth + Android - HELP!!! (Read 3332 times) previous topic - next topic

soaresdss

Hi. I've an Arduino UNO + HC-06 Bluetooth Module + App Inventor App. I can turn on and off a LED with the app, but when i try to send any data from Arduino to Android the app freeze. Has anyone ever experienced this? I think is some trouble with communication between Arduino and Android.

Module Link
http://dx.com/p/jy-mcu-arduino-bluetooth-wireless-serial-port-module-104299

Code: [Select]
#include <SoftwareSerial.h>
int pinGas = 2;
byte Valor_Gas = 0;
int bluetoothTx = 3;
int bluetoothRx = 2;
int serialB;

SoftwareSerial blue(bluetoothRx, bluetoothTx);

void setup()
{
 
  blue.begin(9600);
 
}

void loop()
{

  if (blue.available() > 0) {
  serialB = (int)blue.read();
 
  if (serialB == 9){
 
  Valor_Gas = analogRead(pinGas);
  blue.println(Valor_Gas);
  serialB = 0;

  }
  }
}

StanD

Can you receive data sent from the Arduino on the phone? To make sure the issue is not in the App inventor code, you should use a terminal emulator (like BlueTerm) on the phone for testing. Another possible issue is that some of these BlueTooth modules work well with 3.3v only on the tx and rx lines (even though you can power the module from the 5v pin of the Arduino). You should post your circuit as well.
Arduino experiments, resources and hacks http://42bots.com

Go Up