My project is currently trying to control a tank powered by an Arduino Mega 2560 through Bluetooth from my computer. Little bit of background:
- Computer is running Windows 11
- Using HC-06 Bluetooth Module (Link: https://www.amazon.com/dp/B01CKW4FSI/ref=twister_B07VMQWZN4?_encoding=UTF8&psc=1)
- Using Tera Term for Serial Terminal.
- VCC and GND of the module is plugged into 5V and GND, the TXD and RXD are plugged directly into the Arduino at its respective ports.
The idea of the project is to use W, A, S, D to control the tank. Currently, I am tryin to figure out the Bluetooth serial communication by simply entering keys into the serial port and then the LED on the Arduino will blink for a second to show that data has been received. After I connect pair the Bluetooth module to my laptop and then connect through Tera Term at the correct COM Port, the red blinking light on the module turns solid red (from what I have read, this indicates that I the module is fully connected). Additionally , I have tried downloading the basic code for the HC - 06 for its commands, but when I send "AT" in the Arduino Serial Monitor, there is no "OK" back. If anyone could give me some guidance, much would be appreciated! My program for checking data being sent with the LED is posted below.
#include <SoftwareSerial.h>
#define LED 13
SoftwareSerial BTSerial(14,15); // RX | TX
// HC-06 TX to the Arduino RX on pin 14.
// HC-06 RX to the Arduino TX on pin 15.
void setup()
{
Serial.begin(9600);
BTSerial.begin(9600);
pinMode(LED, OUTPUT);
}
void loop()
{
if(BTSerial.available())
{
digitalWrite(LED, HIGH);
delay(1000);
digitalWrite(LED, LOW);
}
}