I originally tried to send data from an android phone to the bluetooth module-connected arduino uno.
Wiring:
5V UNO ------- Vcc HC-05
G UNO -------- GND HC-05
11 UNO ------- Tx on HC-05
10 UNO ------- Rx on HC-05
and I uploaded this sketch:
Yes I did have a servo connected to pin7 but that never ran upon sending 1 to the arduino via Serial Bluetooth Terminal app on Android. Im able to connect to the hc05 but when I send the commands nothing is received either in the serial monitor or on the android app terminal or on the servo pin 7.
So I decided to check the at commands and I uploaded this sketch to the arduino:
I tried with a wire from pin 9 to the enable pin of the hc05, nothing. I also just noticed that I can connect to it from a serial bt android app and when I send commands from the phone to the hc05 I get nothing in the SM but when I send from the SM to the app at least I get junk.
I tried without the wire to pin 9 but holding the button on the hc05 while powering up, nothing.
By nothing I mean, i get the "Enter AT commands" in the serial monitor but when I enter AT or AT+NAME, I get nothing back.
Here is a picture of the module:
It has a BCM417 chip i see:
Wiring:
5V UNO ------- Vcc HC-05
G UNO -------- GND HC-05
11 UNO ------- Tx on HC-05
10 UNO ------- Rx on HC-05
and I uploaded this sketch:
Code:
#include <Servo.h>
#include <SoftwareSerial.h>
SoftwareSerial bluetooth(11,10); //Rx, Tx method signature
Servo myServo;
void setup() {
delay(1500); // wait for bluetooth module to start
bluetooth.begin(9600);
Serial.begin(9600);
myServo.attach(7);
Serial.println("Ready");
}
void loop() {
// put your main code here, to run repeatedly:
if(bluetooth.available()>0) {
Serial.println("Waiting for data");
int c = bluetooth.read();
bluetooth.println(c);
if(c=='1'){
bluetooth.println("Open Wide");
Serial.println("1");
myServo.write(1000);
} else if(c=='2'){
bluetooth.println("Close");
Serial.println("2");
myServo.write(2000);
}
}
}
So I decided to check the at commands and I uploaded this sketch to the arduino:
Code:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(11,10); // RX, TX
void setup() {
Serial.begin(9600);
pinMode(9,OUTPUT);
digitalWrite(9,HIGH);
Serial.println("Enter AT commands:");
mySerial.begin(38400);
}
void loop(){
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
}
I tried without the wire to pin 9 but holding the button on the hc05 while powering up, nothing.
By nothing I mean, i get the "Enter AT commands" in the serial monitor but when I enter AT or AT+NAME, I get nothing back.
Here is a picture of the module:
It has a BCM417 chip i see: