By dhernaiz0
#32429
Hi,
I recently employed a Romeo BLE (sku DFR0305) on the Devastor platform, everything was working well initially but for some odd reason the bluetooth application is no longer working for me. I used the GoBLE iOS application as well as Ava, I preferred Ava as GoBLE was not as responsive. In using the AVA application everything worked very well. But today I attempted to use the robot and while I can connect to the Bluno via bluetooth on my iPhone 8; neither the AVA or GoBLE application allow me to remote control the device. I tested via the Serial connection and that worked, I am seeing the linked LED illuminated as well. I followed the wiring diagram precisely. Is there any chance I could have a defective unit of the Romeo BLE, or is there some way I could reset the bluetooth connections? I attempted using the button on the board but yeah no luck. Any help would be greatly appreciated

Below is the code I utilized, sourced from an article written by David Such

/*
* BluetoothControl: Control a DFRobot Devastator tank via a Romeo BLE
* (Uno equivalent) using Bluetooth (BLE).
*
* Compatible with iPhone app AVA BLE - https://itunes.apple.com/au/app/ava-ble ... 23233?mt=8
*
*
*/

#define NO_DATA -1
#define MAX_DUTY_CYCLE 255

const byte M2_DIRECTION = 4; // M1 Direction Control
const byte M2_SPEED = 5; // M1 Speed Control
const byte M1_SPEED = 6; // M2 Speed Control
const byte M1_DIRECTION = 7; // M2 Direction Control

const char VERSION[] = "BLE Remote v0.2";

// Task Definitions

enum task_t { statusReport, remoteControl, patrol, followIR, avoidIR, findIR, noTask };
task_t task;
String taskDescription;

bool commsDetected, remoteControlled, speedData;
int speed;

// Motor Control
//////////////////////////////////////////////////////////////////////////////////////////////////////////
// Functions

int dutyCycleFromSpeed()
{
float speedPercentage = (float)speed / 100;
int dutyCycle = MAX_DUTY_CYCLE * speedPercentage;

return constrain(dutyCycle, 0, 255);
}

void stop()
{
digitalWrite(M1_SPEED, LOW);
digitalWrite(M1_DIRECTION, LOW);
digitalWrite(M2_SPEED, LOW);
digitalWrite(M2_DIRECTION, LOW);
}

void forward()
{
int dutyCycle = dutyCycleFromSpeed();

analogWrite (M1_SPEED, dutyCycle);
digitalWrite(M1_DIRECTION, HIGH);
analogWrite (M2_SPEED, dutyCycle);
digitalWrite(M2_DIRECTION, HIGH);
}

void back()
{
int dutyCycle = dutyCycleFromSpeed();

analogWrite (M1_SPEED, dutyCycle);
digitalWrite(M1_DIRECTION, LOW);
analogWrite (M2_SPEED, dutyCycle);
digitalWrite(M2_DIRECTION, LOW);
}

void left()
{
int dutyCycle = dutyCycleFromSpeed();

analogWrite (M1_SPEED, dutyCycle);
digitalWrite(M1_DIRECTION, LOW);
analogWrite (M2_SPEED, dutyCycle);
digitalWrite(M2_DIRECTION, HIGH);
}

void right()
{
int dutyCycle = dutyCycleFromSpeed();

analogWrite (M1_SPEED, dutyCycle);
digitalWrite(M1_DIRECTION, HIGH);
analogWrite (M2_SPEED, dutyCycle);
digitalWrite(M2_DIRECTION, LOW);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////

void setup()
{
// Serial Monitor
Serial.begin(115200);
Serial.println(VERSION);
Serial.println("Romeo BLE Device");
Serial.println("Initializing...");
Serial.println("Serial connected - awaiting command (f, b, l, r, s, t): ");

// PIN Definitions
pinMode(M1_DIRECTION, OUTPUT);
pinMode(M1_SPEED, OUTPUT);
pinMode(M2_DIRECTION, OUTPUT);
pinMode(M2_SPEED, OUTPUT);

// Initial State - stopped with no set task, awaiting command with speed = 100%.
task = remoteControl;
speed = 100;
speedData = false;
digitalWrite(M1_SPEED, LOW);
digitalWrite(M2_SPEED, LOW);
}

void loop() {
if (Serial.available()) {
// Get the number of bytes (characters) available for reading from the serial port.
// This is data that's already arrived and stored in the serial receive buffer (which holds 64 bytes).
char incomingByte = Serial.read();
int oldSpeed = speed;

if (speedData) {
int newSpeed = incomingByte;

speed = constrain(newSpeed, 0 , 100);

Serial.print("Set Speed: ");
Serial.println(speed);
speedData = false;
}
else if (incomingByte != NO_DATA)
{
switch (incomingByte)
{
case 'f':
Serial.print("Forward ");
Serial.print(speed);
Serial.println("%");
forward();
break;
case 'b':
Serial.print("Backward ");
Serial.print(speed);
Serial.println("%");
back();
break;
case 'l':
Serial.println("Turning Left");
speed = 40;
left();
speed = oldSpeed;
break;
case 'r':
Serial.println("Turning Right");
speed = 40;
right();
speed = oldSpeed;
break;
case 't':
Serial.println("Hello");
break;
case 's':
Serial.println("Stopped");
stop();
break;
case 'w':
Serial.println("Set speed 25%");
speed = 25;
break;
case 'x':
Serial.println("Set speed 50%");
speed = 50;
break;
case 'y':
Serial.println("Set speed 75%");
speed = 75;
break;
case 'z':
Serial.println("Set speed 100%");
speed = 100;
break;
case '0':
task = statusReport;
taskDescription = "T0: Status";
Serial.println(taskDescription);
remoteControlled = false;
break;
case '1':
task = remoteControl;
taskDescription = "T1: Remote";
Serial.println(taskDescription);
remoteControlled = true;
break;
case '2':
task = patrol;
taskDescription = "T2: Patrol";
Serial.print(taskDescription);
remoteControlled = false;
break;
case '3':
task = followIR;
taskDescription = "T3: Follow IR";
Serial.print(taskDescription);
remoteControlled = false;
break;
case '4':
task = avoidIR;
taskDescription = "T4: Avoid IR";
Serial.print(taskDescription);
remoteControlled = false;
break;
case '5':
task = findIR;
taskDescription = "T5: Find IR";
Serial.print(taskDescription);
remoteControlled = false;
break;
case '!': // Start byte indicating encoded speed is the next byte
speedData = true;
break;
default:
Serial.println("Unknown Command...");
// Serial.println("Valid Commands are: f = forward, l = left, b = back, r = right, t = test message, s = stop.");
break;
}
}
else stop();
}
}
By nana.wang
#32445
Hi thanks for your support.
We are checking it and will feed you back as soon as possible.
By robert
#32447
The first option you have is to reset the bluetooth settings on the Bluno board. To do that you have to send AT commands to your Bluno device. Please take a look at our Bluno's BLE wiki page under the "Configure the BLE through AT command" section. You can follow those steps exactly and stop after step 11. This will reset your settings to default. After this try reconnecting to your device from your phone and let us know the outcome.

The wiki page is here: https://wiki.dfrobot.com/DFRobot_Blueto ... User_Guide
By dhernaiz0
#32503
Thank you so much, in using the AT command I was able to clear the bluetooth and establish connection. I definitely recommending using the AVA app to control the bot via iOS; I am currently looking into learning more about the AT commands in order to control the robot wirelessly from my computer instead of my phone.