Hi, I am currently new to using the bluetooth module.
Is voltage divider necessary in using bluetooth module for mega 2560?
I just followed the connection on the attachment below. (Not mine)
Just found it here http://www.carobot.cc/how-to/hc-05-guide/
I tried using it in an android app sometimes it runs and sometimes not.
During working times an error of 516 "Broken Pipe" appears and losses all control.
Any solution for broken pipe or not running properly?
Here are the codes in Arduino.
char command;
//Motor A
const int motorPin1 = 10;
const int motorPin2 = 11;
//Motor B
const int motorPin3 = 12;
const int motorPin4 = 13;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(motorPin1, OUTPUT);
pinMode(motorPin2, OUTPUT);
pinMode(motorPin3, OUTPUT);
pinMode(motorPin4, OUTPUT);
}
void loop() {
if (Serial.available() > 0) {
command = Serial.read();
switch (command) {
//==============================================================================
case 'L':
digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, LOW);
break;
//==============================================================================
case 'R':
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, HIGH);
break;
//==============================================================================
case 'F':
digitalWrite(motorPin1, HIGH);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, HIGH);
break;
//==============================================================================
case 'B':
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, HIGH);
digitalWrite(motorPin3, HIGH);
digitalWrite(motorPin4, LOW);
break;
//==============================================================================
case 'S':
digitalWrite(motorPin1, LOW);
digitalWrite(motorPin2, LOW);
digitalWrite(motorPin3, LOW);
digitalWrite(motorPin4, LOW);
break;
//==============================================================================
}
}
