Hírek:

Fontos tudnivalók a migrációval kapcsolatban, kérlek olvasd el:

A régi fórumról áthozott hozzászólásoknál a felhasználó neve adatvédelmi megfontolásokból véletlenszerűen generált értékekre lett  lecserélve. Ez akkor tud a valódi értékre visszaállni, ha az adott felhasználó a régi fórumon nyilatkozik, hogy beleegyezik az adatainak az új fórumra továbbításához, majd ezután itt a régi felhasználónevével és email címével regisztrál.
8~20 óra között, 1~30 percen belül megtörténik a jóváhagyás, 30 percenként ellenőrizd email fiókodat (SPAM-ot is) mindenképp kapsz mail-t, a sikeres regisztrácioról, vagy a hibáról és, hogy mi a teendőd.
Nézd meg  "A régi fórumról, az új fórumra költözés útmutatót."
A régi fórumon használt email címmel de más felhasználói azonosítóval érkező regisztrációs kérelmek törlésre kerűlnek.

Main Menu

Arduino

Indította gaben, 2025 február 03, 18:09

Előző téma - Következő téma

000000000

AUTO CONFIG HC05 RE!!![#vigyor]



/*
1, HC05 BUTTON PRESS + CONTACT VCC HC05 LES 2S BLINKING AT MODE!
 

 
 AUTO SETTING VALUE HC05
AT+CMODE=1
AT+ROLE=0
AT+UART=115200,1,0
--------------------
AT+ORGL

*/


#include <SoftwareSerial.h>
#define ledPin 9 // Connect the HC-05 STATE
SoftwareSerial BTserial(10, 11); // RX | TX
// Connect the HC-05 TX to Arduino pin 10 RX.
// Connect the HC-05 RX to Arduino pin 11 TX
//
void setup() {
  // put your setup code here, to run once:
  pinMode(ledPin, OUTPUT);
   digitalWrite(ledPin, HIGH);
    Serial.begin(9600);
     BTserial.begin(38400);
    Serial.println("AUTO AT SETTING HC05");
   
delay(1000);
    sendCommand("AT");
    delay(100);
    sendCommand("AT+CMODE=1");
    delay(100);
    sendCommand("AT+ROLE=0");
    delay(100);
    sendCommand("AT+UART=115200,1,0");
   
 
}

void sendCommand(const char * command){
  Serial.print("Command send :");
  Serial.println(command);
  BTserial.println(command);
  //wait some time
  delay(100);
 
  char reply[100];
  int i = 0;
  while (BTserial.available()) {
    reply[i] = BTserial.read();
    i += 1;
  }
  //end the string
  reply[i] = '\0';
  Serial.print(reply);
  Serial.println("Reply end");
}

void loop() {

}


PSoft

Műxik ez, faszán!
Máskor, máshol, másra is használható ám ez a hasznos opció!:)

000000000

TESSÉK TANULNI![#vigyor0]
#define BLE_BAUD 9600
ird át
#define BLE_BAUD 38400

000000000

[#sniffles]

  

jani300

Ott van az még :) Csak már ellapozódott ...
Nem igen szoktam rányomni a törlésre .

000000000

ILYENKOR NINCS  HC05 AT MODBAN NINCS "OK"!

  

Arany János

Bocsánat!
Nem gondoltam, hogy figyelni is kell![#nevetes1]
Most itt tart:
Arduino BLE module identification and setup sketch.
Interact with this interface using serial in CR&LF mode.
Enter the number of the RX pin on the Arduino, TX on the module [10] :
Enter the number of the TX pin on the Arduino, RX on the module [11] :
Enter the number of the State pin on the Arduino, State on the module (enter -1 if not present or not connected) [9] :
Opening serial connection to BLE module at pins: 10, 11, 9
Checking module state...
The signal on the state pin is LOW. This means the device is not connected and is in command mode.
Detecting module type
Unexpected result of length=27
xx

000000000

A beszurás kihagya a text formátumot ha < > van!

[615]⎆
eredeti
#include <SoftwareSerial.h>

beszurva csak ez jelenik meg...

#include

[#fejvakaras]

000000000

valami nem volt a helyén lábak vagy state!
azt látom at09 nyitot portot de nem került at modba....

000000000

AUTO CONFIG HC05 RE!!!


/*
1, HC05 BUTTON PRESS + CONTACT VCC HC05 LES 2S BLINKING AT MODE!
 

 
 AUTO SETTING VALUE HC05
AT+CMODE=1
AT+ROLE=0
AT+UART=115200,1,0
--------------------
AT+ORGL

*/


#include <SoftwareSerial.h>
#define ledPin 9 // Connect the HC-05 STATE
SoftwareSerial BTserial(10, 11); // RX | TX
// Connect the HC-05 TX to Arduino pin 10 RX.
// Connect the HC-05 RX to Arduino pin 11 TX
//
void setup() {
  // put your setup code here, to run once:
  pinMode(ledPin, OUTPUT);
   digitalWrite(ledPin, HIGH);
    Serial.begin(9600);
     BTserial.begin(38400);
    Serial.println("AUTO AT SETTING HC05");
   
delay(1000);
    sendCommand("AT");
    delay(100);
    sendCommand("AT+CMODE=1");
    delay(100);
    sendCommand("AT+ROLE=0");
    delay(100);
    sendCommand("AT+UART=115200,1,0");
   
 
}

void sendCommand(const char * command){
  Serial.print("Command send :");
  Serial.println(command);
  BTserial.println(command);
  //wait some time
  delay(100);
 
  char reply[100];
  int i = 0;
  while (BTserial.available()) {
    reply[i] = BTserial.read();
    i += 1;
  }
  //end the string
  reply[i] = '\0';
  Serial.print(reply);
  Serial.println("Reply end");
}

void loop() {

}

Arany János

Lehetséges!
Már csak reggel próbálom újra.
Nagyon köszönöm!!!

y7dccvcjx

Mi az oka, hogy a <SoftwareSerial.h> használjátok? Miért nem jó a fizikai hardveres serial Rx - Tx communikáció?

Ez a szoftveres megoldás nagyon erőforrás igényes.

dezsoe

Az, hogy egyszerre használja a hardverest a PC felé és a szoftverest a BT modul felé.

y7dccvcjx

Ja, úgy! Az arduino 2560 ( mega ) talán több db hw Rx-Tx vonalat is kezel, ha jól emlékszem.

Arany János

Jó reggelt!
Úgy tűnik, hogy minden a helyén volt.
Jelenleg itt tart:

Arduino BLE module identification and setup sketch.
Interact with this interface using serial in CR&LF mode.
Enter the number of the RX pin on the Arduino, TX on the module [10] :
Enter the number of the TX pin on the Arduino, RX on the module [11] :
Enter the number of the State pin on the Arduino, State on the module (enter -1 if not present or not connected) [9] :
Opening serial connection to BLE module at pins: 10, 11, 9
Checking module state...
The signal on the state pin is LOW. This means the device is not connected and is in command mode.
Detecting module type
Unexpected result of length=26
x