Trying to get the AT command to work from the Uno without the use of serial monitor
AT command works fine from serial monitor
but
BTserial.print("Exit"); // prints to app on phone
BTserial.write(65); // A
BTserial.write(84); // T
so the command from the sketch doesn't work
it sends the char to the app via Bluetooth instead of the HM-10 to configure module
Any ideas ???
and reading from this post has no solution HM10 not receiving AT commands from arduino code.
post how you have configured your serial monitor
what line-ending?
what did you really type into the send-field
write it again into the send-field of the serial monitor mark copy & paste into a code-section of a posting
add serial printing of what you send to BTserial
if (Serial.available())
{
c = Serial.read();
// do not send line end characters to the HM-10
if (c!=10 & c!=13 )
{
BTserial.write(c);
Serial.print(c);
}
to echo what was received
put what you want to print to BTSerial into a variable
so you can again send the exact same content to BTSerial and to Serial
char myCommand[] = "Exit";
BTserial.print(myCommand); // prints to app on phone
Serial.print(myCommand);
At any time while the sketch (program) is running i can type in AT and hit send on the serial monitor and it writes to the HM-10 module and not get passed on to the connected device
the AT command will disconnect the Bluetooth device connected to the HM-10 module
I am at a loss on how the HM-10 modular can tell that's its from the serial monitor and not
BTserial.print("AT");
The BTserial.print("AT"); just gets passed on to the attached Bluetooth device (phone)
You can go on for hours days and weeks to describe in short words what you can't believe.
If it nescsessary as a stress relief go on for some postings.
You can stay at assumings "this must work" and shaking your head. It is very unlikely that saying "it must work" or shaking your head will solve the problem.
Stop making assumings like "it can't be that"
Open your mind to check it all. Start with really analysing.
There is any kind of difference that makes the one thing work and the other not.
If you are interested in finding the difference a very careful and precise analyse will help.
Additionally if you want others to support you. You should provide a very detailed and precise description of what works and what works not
For this you should:
describe each single little step from connecting your microcontroller to the USB-cable until sending the last command is finished
post the complete sketch that works using the serial monitor
posting character for character what you write into the send-field of the serial monitor and that you then send to the bluetooth-module
posting what comes back as aknowledgement from the bluetooth-module
post the complete sketch that does not work
assigning each and every character to #defines "constants" or to arrays of char and use variables to send to BTSerial and to the serial monitor
If you think this is too much work for you. .... ----- .... ----- ..... ----- Well decide what ever you want.
Needed delay after BTserial.print ("Exit");
Need a minimal of 11ms Delay to make it work before and after 65-84
10600us or better delay running at 9600 baud
My logic analyzer helped.
Thank you all.