Thank you very much for the clarification.
I am sending you a basic example of serial communication that works perfectly with the Romeo board, as you can see it is the typical example of bidirectional serial communication.
void setup() {
Serial.begin(115200); //initial the Serial
}
void loop() {
if (Serial.available()) {
Serial.write(Serial.read());//send what has been received
Serial.println(); //print line feed character
}
}
I also sent you the wiki page of the board that talks about BLE communication, that example is there.
https://wiki.dfrobot.com/Bluno_SKU_DFR0 … ng_via_BLE
I also attach a program that I wrote to be able to connect said board (mounted on a MiniQ robot) to be controlled from Blynk Legacy (which no longer exists).
// PROGRAMA PARA USO CON ROBOT MINIQ ROMEO
#include <BlynkSimpleSerialBLE.h>
char auth[] = "<codigo autentificacion>";
int E1 = 5; // Control Velocidad Motor 1
int E2 = 6; // Control Velocidad Motor 2
int M1 = 4; // Control Direccion Motor 1
int M2 = 7; // Control Direccion Motor 2
int v = 100;
int vg = 50;
void setup() {
int i;
for (i = 4; i <= 7; i++)
pinMode(i, OUTPUT);
Serial.begin(115200);
Blynk.begin(Serial, auth);
}
void loop() {
Blynk.run();
}
// Utilizado desde blynk para recibir la velocidad desde un Slider
BLYNK_WRITE(V0) {
v = param.asInt();
}
// Utilizado desde blynk para recibir posiciones desde un joystick
BLYNK_WRITE(V1) {
int x = param[0].asInt();
int y = param[1].asInt();
if (x == 128 && y == 128)
Detener();
if (y > 148 && x > 108 && x < 148)
Avanzar(v, v);
else if (y < 108 && x > 108 && x < 148)
Retroceder(v, v);
if (x < 108 && y < 150)
Izquierda(vg, vg);
if (x > 148 && y < 150)
Derecha(vg, vg);
}
// Utilizado desde blynk para recibir la velocidad de giro desde un Slider
BLYNK_WRITE(V2) {
vg = param.asInt();
}
void Detener() {
digitalWrite(E1, LOW);
digitalWrite(E2, LOW);
}
void Avanzar(char a, char b) {
analogWrite (E1, a);
digitalWrite(M1, HIGH);
analogWrite (E2, b);
digitalWrite(M2, HIGH);
}
void Retroceder(char a, char b) {
analogWrite (E1, a);
digitalWrite(M1, LOW);
analogWrite (E2, b);
digitalWrite(M2, LOW);
}
void Izquierda(char a, char b) {
analogWrite (E1, a);
digitalWrite(M1, LOW);
analogWrite (E2, b);
digitalWrite(M2, HIGH);
}
void Derecha(char a,char b) {
analogWrite (E1, a);
digitalWrite(M1, HIGH);
analogWrite (E2, b);
digitalWrite(M2, LOW);
}
I hope you can help me, thank you very much.
Excuse my English, I am using a translator, my language is Spanish.