Renk sensörü, lcd ekran, hc-SR04 ve hc-06 bluetooth modülü birlikte kullanmak

Renk sensörü, lcd ekran, hc-SR04 ve hc-06 bluetooth modülü birlikte kullanarak kırmızı ışıkta ve engel algıladığında duran yeşil ışık yandığında bluetooth ile kontrol etmeye devam edilen araç kodu tasarlarken RX ve TX e bluetooth pinlerini taktığımda seri port ekranı donuyor, lcd ekran donuyor ve bluetooth çalışmıyor. ne yapmam lazım acaba...

robotistanrenkkodu.ino (9.15 KB)

Are you attaching your bluetooth device to the serial pins? Because it looks like you're also using Serial to display data. It should be one or the other.

Turn compiler warnings up to the max in the IDE (Preferences). There's some interesting things it has to say about this for example:

if (K,Y,M);{
  hamza();
  }

Thanks for your answer. I'm using arduino mega. The arduino mega also has many RX and TX pins for serial communication. Can't the LCD display, color sensor and bluetooth be used together?

Kandemirr:
Can't the LCD display, color sensor and bluetooth be used together?

Yes they can. But you probably want your bluetooth device on something that isn't the primary serial port. Serial1 perhaps.

do you have any information on where to fix it in the code?

I don't really understand what your code is trying to do but I'll guess that this:

  //Gelen veriyi 'state' değişkenine kaydet
  if (Serial.available() > 0)
  {
    state = Serial.read();
  }

Should be using Serial1 instead of Serial. You'll need a Serial1.begin in setup too.

Then you'll need to ensure that your bluetooth device is on the Serial1 pins.

şöyle söyleyeyim aşağıdaki kod da void loop bölümüne renk sensörü kodunu nasıl yerleştirebilirim?

robotistanbluetooth.ino (5.11 KB)