App not sending numbers

The app I made to connect to an arduino HC-05 bluetooth module doesn't seem to work. I believe it's because the app doesn't send the numbers properly. I am testing an LED light to light up when it receives the signal '6' and go out with '7'. I'm not sure how to provide the number so the app can understand.

Can someone please explain whether I have to use 'send text' or 'send number' and should I type the number plainly or with additional symbols. Thank you!

The answer depends on how the arduino interprets the incoming data.

Show us the sketch.

Here it is. Also, if you're wondering, for some reason the default state = 48.

#include <SoftwareSerial.h>

SoftwareSerial bluetooth(7, 6);

const int ledPin = 13;

#define LED_ON_COMMAND 54

#define LED_OFF_COMMAND 55

void setup() {


Serial.println("Bluetooth module initialized");


pinMode(ledPin, OUTPUT);


void loop() {

int state = 0;

if (bluetooth.available() > 0) {

state =;

Serial.print("Received state: ");


if (state == LED_ON_COMMAND) {

  digitalWrite(ledPin, HIGH);

  Serial.println("LED ON");

} else if (state == LED_OFF_COMMAND) {

  digitalWrite(ledPin, LOW);

  Serial.println("LED OFF");





Here is a link to the thread on everything BlueTooth:
Bluetooth HC-06. Arduino. Send. Receive. Send text file. Multitouch. Image

It has lots of examples of data type transmission and conversion.

In the Sketch:

So that should be 6 and 7:

#define LED_ON_COMMAND 6

Dear @Vainius,
48 is = 0x30 = ASCII character '0'.It seems that the "state" is never receivng anything, but since 48 is greater than 0 it enters the if (bluetooth.available() > 0) {.....
Are you sure that the HC05 is really receiving something ?

My hint is to send text from AI2, though you are sending numbers, then in your Arduino sketch you shall treat the received stuff as characters, i.e.: '6', '7' etc.

In any case, as @ABG has already said, @Juan_Antonio's web site (KIO4) is a real "treasure pot" and you can find therein lot of ready made examples.

Best wishes.

The app is working well now, thanks everyone!

Please post what worked, both parts, for our collection.