Bienvenido, Invitado
Nombre de Usuario: Contraseña: Recordarme
  • Página:
  • 1
  • 2
  • 3

TEMA:

BLUETOOTH ARDUINO HM18 Y HM19 2 años 8 meses antes #2411

Te adjunto los codigos AT de estos modulos
Gracias
Adjuntos:

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

BLUETOOTH ARDUINO HM18 Y HM19 2 años 8 meses antes #2412

Tengo varios videos de como realizar una conexion maestro/exclavo y digo paso a paso los comandos usados. El problema es que cada dispositivo tiene unos comandos diferentes. Tendras que ver los que uso yo y como hacer lo mismo con el modelo que usas tu.

Si no has configurado el exclavo, el problema es ese, por eso parpadea. Cuando se que fijo es que enlazo.

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

BLUETOOTH ARDUINO HM18 Y HM19 2 años 8 meses antes #2413

He seguido tus videos y creo que he realizado los pasos pero no se me enlaza, estoy tratando de hacerlo con la nextion y tampoco. Te voy a adjuntar el programa de la nextion tan simple como encender un led y apagarlo con dos botones
#include "Nextion.h"
int LedPin = 10;
const int pinEmparejado = 2;
NexButton botEncender = NexButton(1,1,"botEncender");
NexButton botApagar = NexButton(1,2,"botApagar");
NexTouch *nex_listen_list[] =
{
&botEncender,
&botApagar,
NULL
};
void EncenderLed()
{
digitalWrite(LedPin,HIGH);
}
void ApagarLed()
{
digitalWrite(LedPin,LOW);
}
String at_cmd(String cmd_str,String desc_str){ // Procedimiento envio de comandos AT de configuracion.
String str_ii = "";
int ii_0 = 0;
unsigned long t1 = millis();
Serial2.println(cmd_str);
while (true){
char in_char = Serial2.read();
if (int(in_char)==-1 or int(in_char)==42){
if ((millis()-t1)>2000){ // 2 segundos tiempo de reseteo.
return "Error";
}
continue;
}
if (in_char=='\n'){
Serial.print("Bluetooth "+desc_str);
Serial.println(str_ii.substring(0,str_ii.length()));
return str_ii;
}
str_ii+=in_char;
}
}

void conexion()
{
at_cmd("AT+RESET",""); //reset modulo
delay(1000);
at_cmd("AT+CONNL0CEC80F0AD74","resultado:"); //conexion con bluetooth nextion
delay(1000);
}
void setup() {
// put your setup code here, to run once:
pinMode(LedPin,OUTPUT);
nexInit();
Serial.begin(9600);
dbSerialPrintln("setup done");
botEncender.attachPop(EncenderLed);
botApagar.attachPop(ApagarLed);
}

void loop() {
// put your main code here, to run repeatedly:
nexLoop(nex_listen_list);
//COMPROBAMOS QUE ESTA EMPAREJADO
if (!digitalRead(pinEmparejado))
{
conexion();
Serial.println("Conectando");
}
}

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

BLUETOOTH ARDUINO HM18 Y HM19 2 años 8 meses antes #2414

Yo, si tienes problemas, eliminaria todo menos la conexion.
Y te repito que yo no uso el mismo modelo de bluetooth que tu, no me voy a estudiar el datashet para saber que haces mal, eso tendras que hacerlo tu.
El siguiente usuario dijo gracias: manuel-241@hotmail.com

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

Última Edición: por Jose Luis.

BLUETOOTH ARDUINO HM18 Y HM19 2 años 8 meses antes #2415

Con este codigo solo debería de emparejarse verdad?
#include "Nextion.h"
const int pinEmparejado = 2;
NexTouch *nex_listen_list[] =
{
NULL
};
String at_cmd(String cmd_str,String desc_str){ // Procedimiento envio de comandos AT de configuracion.
String str_ii = "";
int ii_0 = 0;
unsigned long t1 = millis();
Serial2.println(cmd_str);
while (true){
char in_char = Serial2.read();
if (int(in_char)==-1 or int(in_char)==42){
if ((millis()-t1)>2000){ // 2 segundos tiempo de reseteo.
return "Error";
}
continue;
}
if (in_char=='\n'){
Serial.print("Bluetooth "+desc_str);
Serial.println(str_ii.substring(0,str_ii.length()));
return str_ii;
}
str_ii+=in_char;
}
}

void conexion()
{
at_cmd("AT+RESET",""); //reset modulo
delay(1000);
at_cmd("AT+CONNL0CEC80F0AD74","resultado:"); //conexion con bluetooth nextion
delay(1000);
}
void setup() {
nexInit();
Serial.begin(9600);
dbSerialPrintln("setup done");
}

void loop() {
// put your main code here, to run repeatedly:
nexLoop(nex_listen_list);
//COMPROBAMOS QUE ESTA EMPAREJADO
if (!digitalRead(pinEmparejado))
{
conexion();
Serial.println("Conectando");
}
}

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

BLUETOOTH ARDUINO HM18 Y HM19 2 años 8 meses antes #2416

Bueno, comprate dos AT09 y sigue las instrucciones del video.
Si usas otro modelo, desconozco su funcionamiento.

Por favor, Identificarse o Crear cuenta para unirse a la conversación.

  • Página:
  • 1
  • 2
  • 3
Tiempo de carga de la página: 0.109 segundos
Gracias a Foro Kunena