Unable to get Multiple Sensor Outputs

I want to display multiple sensor output (temperature,smoke and light density) on my app. But my app shows two errors-
1.Error 503: Specified address is not a valid bluetooth address
2. List Index is too large
Before this project ,I have built a simple app that can display only temperature value from my arduino project and that worked properly without any error. That time I used the same bluetooth module HC-05 and didn't get any error message. Then why I'm facing these Errors? Please help me
Here are my app blocks -



Here is the error Message-

Here is my Code-

float vout;
float temp;
float density;
int gs =A0;
int smoke;

 
void setup() 
{
  
Serial.begin(9600);

}

void loop() {
 
density = analogRead(A2);
smoke = analogRead(gs);
vout=analogRead(A1) ; 
temp= (vout*500)/1023 ;

Serial.print(temp);
Serial.print("|");
Serial.print(smoke);
Serial.print("|");
Serial.println(density);
delay(5000);
}

Here is my Serial Monitor Output-

I have checked my connection several times and found no error

A similar topic. See how the receiving block is built there, and read @ABG's advice on DelimiterByte (10).

You have "serial.println ()" in your arduino code, it's ok. In clock blocks, use a "ReceiveText" block with negative bytes, such as -1, instead of a "connect" block.

In the designer, in the properties of the Bluetooth component, set the value of "Delimiter Byte" to 10.

1 Like

Few things that add up (in addition to Patryk and ABG's notes)

App Inventor

  1. You have set the Clock Timer "Always Fires" to True. That should be False.
  2. Error 503: Receiving data into global 'input', you are using the wrong Blocks!
  3. Before trying to populate the Labels, check that the data list length is correct.

Example:

Arduino Sketch

  1. When sending the data, you must restrict the number of decimals, else your data could be too long. Example: Serial.print(temp,2);

  2. Don't use delay() in the loop, use elapsed time (milliseconds)
    Example:

//ArduinoToApp.ino  02/03/2021 02:38:48

//Fake data stream to demo elapased milliseconds timing


//vars
unsigned long lgUpdateTime;

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

void loop()
{
	           if(millis() - lgUpdateTime > 5000)           //Loop approx every 5 seconds
               {
                         lgUpdateTime = millis();

                         if (Serial.connected())
                         {
                                   //Bluetooth to App
                                   Serial.print("Hello");
                                   Serial.print("|");
                                   Serial.print("World");
                                   Serial.print("|");
                                   Serial.println();        //This last line tells App "End of Data" = Ascii LineFeed Char Number 10
                         }
               }
}

All of this assumes that your Arduino is setup correctly.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.