Sending number from Android to Arduino

Hi,

I'm trying to send data via bluetooth from an Android app created with App Inventor to control my Arduino. This data is just a number.

  • The number is either 1 ou 2.
  • The communication goes through bluetooth
  • I get something in arduino when I click on my Phone application send button (I can see a character being received using the Serial Monitor)

The thing is, no matter what I use in App Inventor to send my data via bluetooth (SendText or Send1ByteNumber), I always receive an "FF" byte on the Arduino side (or its ASCII equivalent or 256 if I convert it to a number).

I've googled quite a lot and spend a few hours trying different options. No luck.

Any help would be appreciated!

Chris

I don't know what App Inventor is, but are you sure that the data it sends is correct? You could be barking up the wrong tree.

quentic:
s, no matter what I use in App Inventor to send my data via bluetooth

Why not use an already invented bluetooth terminal. If that works you know where the problem is.

Post your Arduino code. Did you check whether there is a character before reading? If not, Serial.read() always returns FF.

Have a look at the examples in Serial Input Basics - simple reliable wasy to receive data.

Ideally get your AppInventor code to send the data in the format of the 3rd example.

...R

Thanks for all your suggestions.

I'm wondering if I'm not simply facing a problem of voltage. Some posts say that RX should be connected to a voltage divider to get 3.3V, some says RX can be connected directly to TX Arduino port (I'm using Software Serial).

By the way, when I send AT commands to the HC-06 through Serial Monitor, I don't get any answer.

Chris

If your Bluetooth module operates at 3.3v then you can damage it if you connect it to an Arduino 5v output pin.

An Arduino input pin should work fine with the 3.3v signal.

...R

Where is your code?