Bluetooth + Serial Monitor = Trouble?

i have the same thing but with bluthooth i connect bluethot with my phone cant send any thing in the serial moniter or from my phone to the serial moniter

I suggest that you start your own thread.

Post your code. Tell us what the code actually does and how that differs from what you want.

Read the forum guidelines to see how to properly post code.

Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

its for a bluthooth car

#include<SoftwareSerial.h>
#include <AFMotor.h>
SoftwareSerial mySerial(18, 19); 
AF_DCMotor motor1(1);
AF_DCMotor motor2(2);
AF_DCMotor motor3(3);
AF_DCMotor motor4(4);

char bt='S';
void setup()
{
  Serial.begin(9600);
  Serial.println();
 
  motor1.setSpeed(255);
  motor2.setSpeed(255);
  motor3.setSpeed(255);
  motor4.setSpeed(255);
  Stop();
}


void loop() {
 
bt=Serial.read();

if(bt=='F')
{
 forward(); 
}

if(bt=='B')
{
 backward(); 
}

if(bt=='L')
{
 left(); 
}

if(bt=='R')
{
 right(); 
}

if(bt=='S')
{
 Stop(); 
}

}
void forward()
{
     motor1.run(FORWARD);
  motor2.run(FORWARD);
  motor3.run(FORWARD);
  motor4.run(FORWARD);
}

void backward()
{
     motor1.run(BACKWARD);
  motor2.run(BACKWARD);
  motor3.run(BACKWARD);
  motor4.run(BACKWARD);
}
void left()
{
  motor1.run(FORWARD);
  motor2.run(FORWARD);
  motor3.run(BACKWARD);
  motor4.run(BACKWARD);
}
void right()
{
  motor1.run(BACKWARD);
  motor2.run(BACKWARD);
  motor3.run(FORWARD);
  motor4.run(FORWARD);
}
void Stop()
{
  motor1.run(RELEASE);
  motor2.run(RELEASE);
  motor3.run(RELEASE);
  motor4.run(RELEASE);
}

The first thing that I see is that you try to read from the serial port before you know if there is anything available in the receive buffer to read. The serial input basics tutorial
will help to understand how to read serial input.

i therer is something with the sending text but the serial working i haved typed a text to appear in the srial moniter when the program starts and its star but i have connected a hc05 bluthooth moduel and send massage and nothing appeared
i did the same thing but sending from the computer to the arduino with the serial but nothing appeaered

What Bluetooth module are you using?

It looks like you are using an Arduino Mega board. Is that right? If so, using SoftwareSerial is silly. Why not use one of the extra hardware serial ports for the Bluetooth module instead of SoftwareSerial. Pins 18 and 19 are the pins for Serial1.

Is the Bluetooth module connected to pins 18 and 19. That is BT TX to Mega pin 19 and BT RX connected to pin 18 through a voltage divider?

i have and after edititng my code when i send somthing yhis popup

21:35:53.877 → f
21:35:53.877 →
21:35:53.911 →

alot fo blanks

hc05

ihave just bought it

I would like answers to my questions.

That looks like if may be receiving ‘f’ and a carriage return and line feed. The carriage return and line feed are invisible characters.

When ever you make a change to your code, post the newest version so we can keep up.

hey i still cant resive massage from the hc05

so what should i connected to

SoftwareSerial mySerial(18, 19); 

Do not use software serial on the Mega. Use Serial1 on those pins. See this thread https://forum.arduino.cc/t/using-hc-05-and-mega-2560/857677

i have changed my tx\rx to 50,51 one but i still cant reseve

Why are you ignoring all advice and using Software Serial on a Mega. You paid for 4 hardware serial ports, you should use them.

i haved typed them in the code and its not woking#`

<SoftwareSerial.h>
#include <AFMotor.h>
AF_DCMotor motor1(1);
AF_DCMotor motor2(2);
AF_DCMotor motor3(3);
AF_DCMotor motor4(4);
char receivedChar;
boolean newData = false;
HardwareSerial myserial (50,51);


char bt='S';
void setup() {
  Serial.begin(9600);           
  Serial.println();
 motor1.setSpeed(255);
 motor2.setSpeed(255);
 motor3.setSpeed(255);
 motor4.setSpeed(255);
 stop()
  
}
void loop() {
  uint8_t i;
  
recvOneChar();
    showNewData();
 
  bt=Serial.read();

if(bt=='F')
{
 forward(); 
}

if(bt=='B')
{
 backward(); 
}

if(bt=='L')
{
 left(); 
}

if(bt=='R')
{
 right(); 
}

if(bt=='S')
{
 Stop(); 
}

}
void forward()
{
     motor1.run(FORWARD);
  motor2.run(FORWARD);
  motor3.run(FORWARD);
  motor4.run(FORWARD);
}

void backward()
{
     motor1.run(BACKWARD);
  motor2.run(BACKWARD);
  motor3.run(BACKWARD);
  motor4.run(BACKWARD);
}
void left()
{
  motor1.run(FORWARD);
  motor2.run(FORWARD);
  motor3.run(BACKWARD);
  motor4.run(BACKWARD);
}
void right()
{
  motor1.run(BACKWARD);
  motor2.run(BACKWARD);
  motor3.run(FORWARD);
  motor4.run(FORWARD);
}
void Stop()
{
  motor1.run(RELEASE);
  motor2.run(RELEASE);
  motor3.run(RELEASE);
  motor4.run(RELEASE);
}
void recvOneChar() {
    if (Serial.available() > 0) {
        receivedChar = Serial.read();
        newData = true;
    }
}

void showNewData() {
    if (newData == true) {
           Serial.println(receivedChar);
        newData = false;
        }}
}

Posting code using code tags is a “skills filter”. If you can not figure out how to post your code, you will not be able to figure out how to write it or fix it.

Perhaps this will help
https://forum.arduino.cc/t/adding-code-tags-after-youve-already-posted-without-code-tags/855552

HardwareSerial myserial (50,51);

What is this? You are inventing things. Use Serial1 on pins 18 and 19. Be sure to connect the module RX to the mega TX and the module TX to the mega RX.

recvOneChar();
showNewData();

//bt=Serial.read();

You on the right track here, but once you have read the Serial input with recvOneChar() don’t do another read for bt as there will be nothing there, except perhaps a new line or carriage return.

hey thanks for helping i really appreciate that
but now i can receive strings from the hc05
but i cant send strings in the serial moniter and the strings that i recive from the hc 05
is only one letter

Sorry to hear that.

hey iave now a new problem
i have plugged a dht sensor but it says fail and i think it becuase i have a problem in every single sketch that when i send any any thing it just dispears
so please any body can help