Bluetooth modul - ZS040
Napsal: 17 pro 2018, 19:56
Dobrý den. Chtěl bych napragramovat modul ZS-040 (HM-05) tak, aby přijímal informace z mobilu a posílal je do arduina. Bohužel jsem se zasekl již na samotné konfiguraci modulu. Nemohu totiž konfiguraci spustit. Chtěl bych se Vás tedy optat, zda nevíte co s tím.
PINOUT Arduino MEGA:
VCC - 3,3V
GND - GND
RXD - RX0
TXD - TX0
EN - 5V
Program pro konfiguraci bluetooth, vždy vyhodí hodnotu po čtení na serial portu xx?x?xxx?x?xxxx??x?x??xx?x?x?x??x?x
Ledka co má při AT módu blikat s intervalem 2s bliká stále jen s intervalem 1s
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(10, 11); // RX | TX
void setup() {
pinMode(22, OUTPUT); // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
digitalWrite(22, HIGH);
Serial.begin(9600);
Serial.println("Enter AT commands:");
BTSerial.begin(38400); // HC-05 default speed in AT command more
}
void loop() {
// Keep reading from HC-05 and send to Arduino Serial Monitor
if (BTSerial.available())
Serial.write(BTSerial.read());
// Keep reading from Arduino Serial Monitor and send to HC-05
if (Serial.available())
BTSerial.write(Serial.read());
}
PINOUT Arduino MEGA:
VCC - 3,3V
GND - GND
RXD - RX0
TXD - TX0
EN - 5V
Program pro konfiguraci bluetooth, vždy vyhodí hodnotu po čtení na serial portu xx?x?xxx?x?xxxx??x?x??xx?x?x?x??x?x
Ledka co má při AT módu blikat s intervalem 2s bliká stále jen s intervalem 1s
#include <SoftwareSerial.h>
SoftwareSerial BTSerial(10, 11); // RX | TX
void setup() {
pinMode(22, OUTPUT); // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
digitalWrite(22, HIGH);
Serial.begin(9600);
Serial.println("Enter AT commands:");
BTSerial.begin(38400); // HC-05 default speed in AT command more
}
void loop() {
// Keep reading from HC-05 and send to Arduino Serial Monitor
if (BTSerial.available())
Serial.write(BTSerial.read());
// Keep reading from Arduino Serial Monitor and send to HC-05
if (Serial.available())
BTSerial.write(Serial.read());
}