Hi!
Currently trying to navigate my way through HC-06 and trying to establish a connection with Serial Monitor App.
#include <SoftwareSerial.h>
#include <Keyboard.h>
SoftwareSerial BT(10, 11);
const int flexPin0 = A0; //pin A0 to read analog input
const int flexPin1 = A1; //pin A0 to read analog input
const int flexPin2 = A2; //pin A0 to read analog input
const int flexPin3 = A3; //pin A0 to read analog input
int value0; //save analog value
int value1; //save analog value
int value2; //save analog value
int value3; //save analog value
int a; // stores incoming character from other device
int b;
int c;
int d;
int e;
int f;
void setup()
{
Serial.begin(9600);
BT.begin(9600);
BT.println("Hello from Arduino");
pinMode(A0,INPUT_PULLUP);
pinMode(A1,INPUT_PULLUP);
pinMode(A2,INPUT_PULLUP);
pinMode(A3,INPUT_PULLUP);
Keyboard.begin();
}
void loop()
{
if (BT.available())
{
//a=(BT.read());
//while (a=='1')
// {
value0 = analogRead(flexPin0); //Read and save analog value from potentiometer
Serial.println(value0);//Read and save analog value from potentiometer
delay (100);
value1 = analogRead(flexPin1);
//Serial.println(value1);//Read and save analog value from potentiometee
delay (100);
value2 = analogRead(flexPin2); //Read and save analog value from potentiometer
//Serial.println(value2);//Read and save analog value from potentiometer
delay (100);
value3 = analogRead(flexPin3); //Read and save analog value from potentiometer
//Serial.println(value3);//Read and save analog value from potentiometer
delay (100);
if (analogRead(A0) >= 970)
{
Keyboard.print("A");
Keyboard.release("A");
b=b+1;
} else if (analogRead(A1) >= 970 )
{
Keyboard.print("S");
Keyboard.release("S");
c=c+1;
} else if (analogRead(A2)>= 800 )
{
Keyboard.print("D");
Keyboard.release("D");
d=d+1;
}else if (analogRead(A3) >= 800)
{
Keyboard.print("F");
Keyboard.release("F");
e=e+1;
}
/*f=(BT.read());
if (f =='2')
{
BT.print("A:") ; BT.println(c) ;
BT.print("S:") ; BT.println(d) ;
BT.print("D:") ; BT.println(e) ;
BT.print("F:") ; BT.println(f) ;
}*/
//}
}
}
I closed out most of the code because I'm just trying out the HC-06. From my understanding, once the HC-06 has established a connection with the software, it will print out the values of value0. While the app says a connection has been successfully established, the serial monitor does not show any value.
Am I missing something?