I'm trying to create eyes for a project, and while I have been able to properly program the different expressions, and have them triggered by commands from the COM3 terminal, I have not been able to make any commands from the Bluetooth Terminal on my phone work.
Details:
Mega2560
2x 8x8 LED Displays - MAX7219
HC-05 Bluetooth Transceiver - default Baud - 9600
Using LEDControl.h, SoftwareSerial.h
This is the loop on my device, when I type the commands A, B, etc. into the COM3 terminal it works just fine, but the same commands on the phone are just interpreted as ASCII, even when I put parentheses around them.
void loop()
{
// Feed any data from bluetooth to Terminal.
if (EEBlue.available()){
Serial.write(EEBlue.read());
}
if (Serial.available()) //verifies if there is serial data available
{
char cmd = Serial.read();
if(cmd == 'A') {
display_eyes(eye_neutral_l, eye_neutral_r);
}
if(cmd == 'B') {
display_eyes(eye_shock_l, eye_shock_r);
}
if(cmd == 'C') {
display_eyes(eye_love_l, eye_love_r);
}
if(cmd == 'D') {
display_eyes(eye_suspicious_l, eye_suspicious_r);
}
if(cmd == 'E') {
display_eyes(eye_happy_l, eye_happy_r);
}
if(cmd == 'F') {
display_eyes(eye_hurt_l, eye_hurt_r);
}
if(cmd == '1') {
display_eyes(eye_mad_l, eye_mad_r);
}
// Feed all data from termial to bluetooth
EEBlue.write(Serial.read());
}
}
Serial
, which as I assume is connected to the PC. When there is data on theEEBlue
interface, you just echoing it toSerial
, but you don't process it.