Bluetooth + Arduino UNO Proteus ISIS Connection

Hello everyone,
I've been trying for 1 week now about this problem and still can't find a solution. I'm trying to connect my arduino with the inventor app i created. The connection between my PC and the phone works but I'm not receiving any data.

Arduino print code:

    digitalWrite(12, LOW);
    motor.write(90);
    affichage(i);
    Serial.print(i);
    Serial.print("\n");
    delay(1500); 

App Inventor block:

PS: bluetooth DelimiterByte is : 10

And for proteus, I've created a new COM port added it to the HC-05 bluetooth component and still not receiving any data.

Would appreciate your help, thanks in advance!

Hello Hachem

Well, your Topic description is a bit confusing :upside_down_face:

Concentrating on Arduino to App:

setup()
Use 9600 baud rate: Serial.begin(9600);

loop()
Change: Serial.print("\n")
To: Serial,println()

I can only assume you have the print code inside the Main Loop. The only data the App will receive is whatever the value of 'i' is - which we can't see the assignment of in your snippet (far better to give variables meaningful names).

  • Ensure your App Clock Timer is a bit faster than the Sketch Loop - say 1000 milliseconds.
  • Ensure the device you are running the App on has Location switched on (and bluetooth!)
  • In your Clock1 Timer Block, use an Else to indicate connection is lost.
  • The Assignment to Label8 is pointless, add an Else to indicate if there are no bytes to receive.

https://www.professorcad.co.uk/appinventortips#TipsArduino

1 Like

Here is an example App Inventor project that collects one value from an Arduino (or other microcontroller using Bluetooth Classic):

BT_Basic_Setup.aia (8.4 KB)

1 Like

... and this is a basic Ardunio Sketch (.ino) that sends one value:

//ArduinoToApp.ino  Chris Ward 29/10/2019 21:56:22

//Fake data stream to test App

//include the library code:
#include <SoftwareSerial.h>

//vars
unsigned int igUpdateTime;

void setup()
{
       Serial.begin(9600);
       igUpdateTime = millis();
}

void loop()
{
	  if(millis() - igUpdateTime > 2000) //Loop approx every 2 seconds
         {
           igUpdateTime = millis();

           if (Serial.connected())
           {
                     //To App via Bluetooth
                     Serial.print("Hello");
                     Serial.println();  //This tells App "End of Data"
                                        //= Ascii LineFeed Char Num 10
           }
      }
}
1 Like

Thank youu it worked! Looks like i had some COM ports problem but your aia file helped a lot!
Appreciated mate.