GAS SENSOR (my project is about gas sensor using arduino. but the problem is after i run the program it says "list index too large" so what should I do?)

my project is about gas sensor using arduino. but the problem is after i run the program it says "list index too large" so what should I do?



Talk to the person who wrote the sketch that measures the gas and decide who gets to decide on Normal.

means??

Meansthe problem with the message the app recieves on the bluetooth. So the question is, how is a message the arduino sends to the app looks like. Because you ask for a list with at least two elements in your app, but seems the message that the arduino send is not like that.

Upload the sketch here.

Sketch is source code from Arduino.

1 Like



14

The data sending method you use in Arduino is not compatible with the data receiving method you use in AppInventor. Modify sending data to send all data in one message like this:

void loop()  {
  gasVal = analogRead(GasInput);
  float temperature = dth.readTemperature();
  String status;
  if (gasVal >= Max_gas) {
    status = "Danger";
  } else {
    status = "Normal";
  }
  bluetooth.println("GasLevel: " + gasVal + ";Temperature: " + temperature + ";" + status);
  delay(1000);
}

and blocks: