Packet too big and Wasn't online yet using Arduino

I don’t know whats wrong :frowning: The serial monitor always said connecting…packet too big. My Bluetooth also sometimes cannot be connected somehow. And there’s a message in the blynk app saying Wasn’t online yet. What to do guys?

#include <HX711_ADC.h> 
#include <Wire.h>
#define BLYNK_USE_DIRECT_CONNECT
#define BLYNK_PRINT Serial

#include <BlynkSimpleSerialBLE.h>

WidgetLCD lcd(V2);

char auth[] = "Bbixez5jmpQXDQatBXIV9LHDGRrWAY2z";


int switchPin=7;
float weight;

HX711_ADC LoadCell(9,10);

void setup() {
  pinMode(switchPin,INPUT);
  //Motor=0;

  LoadCell.begin();
  LoadCell.start(500);
  LoadCell.setCalFactor(1171);

  Serial.begin(38400);

  Serial.println("Setting up");
  Blynk.begin(Serial, auth);

  Serial.println("Connected");
}

void loop() {

  Blynk.run();
  
  if (digitalRead(switchPin)){
    LoadCell.update(); // retrieves data from the load cell
    float i = LoadCell.getData(); // get output value

    //Motor=map(i,0,1023,0,255);
    //analogWrite(5,Motor);

    Blynk.virtualWrite(V3,i);
    delay(2000);
    lcd.print(0,0,"Mixing waste");

    //Serial.print("Mixing ");
    Serial.print(i);
    //Serial.println("grams of waste");
 
    delay(1000);
  } 
  else {
    Serial.print("Turn on the switch to mix ");
    //Motor=0;
    //analogWrite(5,Motor);
    
    lcd.print(0,0,"WasteNova static mode");
    lcd.print(0,1,"Bacterial activity on going");
    delay(1000);
  }
}

@Student please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

1 Like

Hi @PeteKnight
I edited the code, now it’s better, thanks!
Do you have suggestions for my problems? I am using Bluetooth module hc05

You’re doing two things wrong…

  1. your serial port is being used for both communication with the Bluetooth module, and Blynk/Debug messages. This will mean that the Bluetooth module is seeing data that it’s not expecting, and won’t know what to do with it.

  2. you have a very cluttered void loop, and it also contains blocking delays. You need to use a timer to solve these problems.

The solution to (1) will depend on which Arduino board you are using. If it’s a Mega then simply use a different hardware serial port for the Bluetooth module. If it’s a Uno/Nano then you’ll need to create a software serial port, but this won’t work for speeds above 9600 baud, so you’ll need to reconfigure your Bluetooth module to work at this speed.

Read this;

http://help.blynk.cc/getting-started-library-auth-token-code-examples/blynk-basics/keep-your-void-loop-clean

for information about how to solve issue (2).

Pete.

1 Like