BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Having trouble connecting Arduino Nano Bluno board to BLE on Blynk

Hello - I am working on a project where I got the BLE connection to work last week, but for some reason now I cannot connect. Also, on the app it says “BLE support is in prototyping and not available for standalone application”. Does this mean we cannot use the BLE function? I have tried switching ports, updating all libraries, refreshing the auth token, resetting, etc.

Here is my code:
Always use code formatting when pasting code .

//to communicate with Blynk app
#include <BlynkSimpleSerialBLE.h>

/************************** Global Variables *********************************/
// Question: How many motors can the battery power to still get strong vibrations?
// Want to make it so it only powers about 3-4 motors at the same time but rapid changes which motors vibrate


//Motor pin assignments
#define tl 5  //Top left motor is on pin 5
#define tr 6  //Top right motor is on pin 6
#define tp 7  // Top motor on pin 7
#define bm 8 // Top motor is on pin 8
#define bl 10 //Bottom left motor is on pin 10
#define br 11 //Bottom right motor is on pin 11


//Motor Pair Variables
int ma1 = tl;  //Motor1 for pair a
int ma2 = bl; //Motor2 for pair a
int ma3 = tp; // Motor 3 for pair a
int mb1 = tr;  //Motor1 for pair b
int mb2 = br; //Motor2 for pair b
int mb3 = bm; // Motor 3 for pair a

//Input Variables
int v = 0; //Vibration strength

  
int t = 300; //Time between alternations

// Want the timing of the switching of motor states to be every 300 milliseconds. Don't know if that means t should equal this or t1 shold equal this
int m = 1; //Motor alternation mode
int p = 0; //On/Off for watch vibration


//Vibration Variables
int motorState = 0;   //Decides which motor pair to turn on/off
unsigned long t1; //Used to determine time between alternations

//Authentification code to connect to blynk
char auth[] = "vOK9rlIAxHERp7wE7MLCkQycJjgA5nbD";
// Need to change this for specific Blynk

void setup()
{
  // BLE Setup
  Serial.begin(115200); //Initializes serial communications
  Blynk.begin(Serial, auth); //Initializes Blynk start-up protocol
  // Set up manual and BLYNK options

  //Pin Setup
  pinMode(tl,OUTPUT); //Set top left motor as an output
  pinMode(tr,OUTPUT); //Set top right motor as an output
  pinMode(tp, OUTPUT);  // Set top motor as an output
  pinMode(bl,OUTPUT); //Set bottom left motor as an output
  pinMode(br,OUTPUT); //Set bottom right motor as an output
  pinMode(bm, OUTPUT); // Set as outpit
 
}

void loop()
{
  //Get Inputs
  Blynk.run();

  //Assign Motors
  assignMotors();

  //Vibration Logic
  if(p && Blynk.connected()){
    vibrate();
  }else{
    stopVibrate();
    p = 0;
  }
}


//Method that chooses which motors alternate. Depending on what value is stored in m,
//which is determined by the value sent from the Blynk app, there will be different 
//motor pairs assigned.

// This is where motor pairs (6) comes in 
void assignMotors() {

  //Left and Right
  if(m == 1){
    //Left Motors
    ma1 = tl;
    ma2 = bl;
    mb3 = bm;

    //Right Motors
    mb1 = tr;
    mb2 = br;
    ma3 = tp;
  }
    
}


// Figure out the timing of the vibrations and just make it constant
// Want to have two options: timing constant but also one that doesnt alternate vibrations and they are just always constant

//Method that turns on the motors. After t milliseconds of time have passed, it switches
//which motor pair is on and which is off.
void vibrate(){
  if(millis()-t1 > t){
    switchMotors(); //Switch motor vibration
    t1 = millis(); //Reset time counter after the 7 patterns have been done
  }
}

//This method switches which motor pair is vibrating. This is done using seven states.
void switchMotors(){
  if(motorState == 0){
    //Turn motor pair A on and B off
    analogWrite(ma1,v);
    analogWrite(ma2,v);
    analogWrite(ma3,v);
    analogWrite(mb1,0);
    analogWrite(mb2,0);
    analogWrite(mb3,0);

    motorState = motorState + 1;
  }
  else if(motorState == 1)
  {
    //Turn motor pair A off and B on
    analogWrite(ma1,0);
    analogWrite(ma2,0);
    analogWrite(ma3,0);
    analogWrite(mb1,v);
    analogWrite(mb2,v);
    analogWrite(mb3,v);

    
    motorState = motorState + 1;
  }
  else if(motorState == 2) {
    analogWrite(ma1,v);
    analogWrite(ma2,0);
    analogWrite(ma3,v);
    analogWrite(mb1,0);
    analogWrite(mb2,v);
    analogWrite(mb3,0);
    
    motorState = motorState + 1;
  }

    else if(motorState == 3) {
    analogWrite(ma1,0);
    analogWrite(ma2,v);
    analogWrite(ma3,0);
    analogWrite(mb1,v);
    analogWrite(mb2,0);
    analogWrite(mb3,v);
    
    motorState = motorState + 1;
  }
    else if(motorState == 4) {
    analogWrite(ma1,v);
    analogWrite(ma2,v);
    analogWrite(ma3,0);
    analogWrite(mb1,0);
    analogWrite(mb2,v);
    analogWrite(mb3,0);

    motorState = motorState + 1;
  }
    else if(motorState == 5) {
    analogWrite(ma1,v);
    analogWrite(ma2,0);
    analogWrite(ma3,v);
    analogWrite(mb1,v);
    analogWrite(mb2,0);
    analogWrite(mb3,0);

    motorState = motorState + 1;
  }
    else if(motorState == 6) {
    analogWrite(ma1,v);
    analogWrite(ma2,0);
    analogWrite(ma3,0);
    analogWrite(mb1,0);
    analogWrite(mb2,v);
    analogWrite(mb3,v);

    motorState = 0;
  }
}

//This method turns off all the motors.
void stopVibrate(){
  //Turn off all motors
  analogWrite(ma1,0);
  analogWrite(ma2,0);
  analogWrite(ma3,0);
  analogWrite(mb1,0);
  analogWrite(mb2,0);
  analogWrite(mb3,0);
}

/************* BLYNK LIBRARY METHODS *************************/
//These methods are called whenever a button is pressed or
//a slider is moved on the app. When Blynk sends a value to
//the Arduino, that value is stored in a variable depending
//on which slider/button is pressed.

//Assign V0 to v
BLYNK_WRITE(V0)
{
  v = param.asInt();
}

//Assign V1 to t
BLYNK_WRITE(V1)
{
  t = param.asInt();
}

//Assign V2 to m
BLYNK_WRITE(V2){
  m = param.asInt();
}

//Assign V3 to p
BLYNK_WRITE(V3){
  p = param.asInt();
}