Serial communication with arduino

We designed an autonomous vehicle. The microprocessor of the vehicle is stm32vgt6. We used Arduino UNO board and Arduino joystick shield for remote control of the vehicle. We used APC 220 v3.0 for communication between the remote control and the vehicle. But we have a problem with communication. Very close to the vehicle, it transmits data properly and the wheels turn. However, if we move even one step away from the vehicle, communication is interrupted. We think there is a signal problem. Does anyone have a solution or diagnosis of the problem?

Welcome to the forum

Do you think that it might help if you posted the code for both the transmitter and receiver, a schematic for both of them, details of the hardware being used and details of how they are powered ?

yes

It is our remote control code.#include <SoftwareSerial.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>

String veri;
String ilerigerigonder;
String direksiyon;
String otonom;
String kapat;
float sagsol;
float ilerigeri;
int buton1= 5;
int buton2= 3;
int buton3= 4;

int apc_volt=A3;
String veri1;
String veri2;
String side="00";
SoftwareSerial mySerial(10,11);

void setup() {
Serial.begin(9600);
mySerial.begin(9600);

pinMode(buton1,INPUT);
pinMode(buton2,INPUT);
pinMode(buton3,INPUT);
//pinMode(role,OUTPUT);
pinMode(apc_volt,OUTPUT);
digitalWrite(apc_volt,HIGH);

delay(5000);
Serial.println("Setup completed");
}
void loop() {

sagsol=analogRead(A0);
ilerigeri=analogRead(A1);

/Serial.print("sagsol: ");
Serial.println(sagsol);
Serial.print("ilerigeri: ");
Serial.println(ilerigeri);
/

if(ilerigeri<300)
{
ilerigerigonder="0";

}

if(ilerigeri>700)
{
ilerigerigonder="1";
}
if(sagsol > 350 && sagsol < 700) //sagsol>700'dü eskisinde. ama en sağda max 650 alıyor. ortada 336 gibi. en sol ise 0. bu yüzden bu aralıklara göre değiştirdim.
{
direksiyon="15";
}
if(sagsol<300)
{
direksiyon="75";
}
if((700>ilerigeri)&&(ilerigeri>300)&&((350>sagsol)&&(sagsol>300))) //eskisi 700>sagsol. ama yukarda değiştirdiğim için burayı da değiştirdim.
{
direksiyon="45";
ilerigerigonder="0";
}

/Serial.print("ilerigerigonder: ");
Serial.println(ilerigerigonder);
Serial.print("direksiyon: ");
Serial.println(direksiyon);
/

if(digitalRead(buton1)==0) //Otonom mod butona basıldı
{
otonom="0";
mySerial.print("[0,45,0]");
}

if(digitalRead(buton2)==0) //Manuel mod
{
otonom="1";
}
if(digitalRead(buton3)==0)
{
otonom="0";
direksiyon="45";
ilerigerigonder="0";
kapat="1";
veri2= '['+otonom+','+direksiyon+','+ilerigerigonder+kapat+']';
mySerial.print(veri2);
Serial.print(veri2);

}

if(otonom=="0")//Otonom moddayken veri al ekrana bas D butununa bas
{

veri1= mySerial.readStringUntil('*');
Serial.println(veri1);

}
if(otonom=="1")//Manuel oddayken veri gönder B butonuna bas
{
//side=mySerial.readStringUntil('*');
veri='['+otonom+','+direksiyon+','+ilerigerigonder+']';
mySerial.print(veri);
Serial.print(veri);
delay(250);

}

}
This is the STM32 code, which is the microprocessor of the car. I am writing the part that communicates with the remote control.
/* USER CODE END Header_funcUART */
void funcUART(void argument)
{
/
USER CODE BEGIN funcUART /
/
Infinite loop */
for (;:wink: {
FTDITask();
if (isFTDIDataReady()) {
FTDIGetData(alinanVeri);
direksiyonAci = ((alinanVeri[3] - '0') * 10)
+ (alinanVeri[4] - '0');
motor = alinanVeri2[6] - '0';
//role = alinanVeri2[8] - '0';
fren = alinanVeri2[6]-'0';

	}
	donme=0;

	 //değeri oku ve durumu statusRE'ye eşitle
	 //HAL_UART_Receive_IT(&huart4, alinanVeri2, 8);
	 milat=HAL_UART_Receive_IT(&huart4, alinanVeri2,8);
	 //milat=HAL_UART_Receive(&huart4, alinanVeri2, sizeof(alinanVeri2), 8);
	 if(alinanVeri2[2]==',' && alinanVeri2[5]==','){
	 for(int i=0; i<8;i++)
	 {
	 alinanVeri3[i]=alinanVeri2[i];
	 }
	 }



	 if(alinanVeri2[0]=='[' && alinanVeri2[7]==']')
	 {
	 for(int i=0; i<8;i++)
	 {
	 alinanVeri3[i]=alinanVeri2[i];
	 }
	 }
	 if(alinanVeri2[1]=='1')
	 {
	 if(alinanVeri2[0]=='[' && alinanVeri2[7]==']')
	 {

	 direksiyonAci=((alinanVeri2[3]-'0')*10)+(alinanVeri2[4]-'0');
	 motor= alinanVeri2[6]-'0';
	 role=alinanVeri2[8]-'0';
	 //fren = alinanVeri2[6]-'0';
	 //farDeger=((alinanVeri2[8]-'0')*10)+(alinanVeri2[9]-'0');
	 }
	 }



	 else if(alinanVeri2[1]=='0')
	 {

	 if(alinanVeri[0]=='[' && alinanVeri[7]==']')
	 {
	 direksiyonAci=((alinanVeri[3]-'0')*10)+(alinanVeri[4]-'0');
	 fren = alinanVeri[6]-'0';
	 motor= alinanVeri[6]-'0';
	 //farDeger=((alinanVeri[8]-'0')*10)+(alinanVeri[9]-'0');
	 }
	 }


	 //milat= HAL_UART_Receive_IT(&huart4, alinanVeri2, 8);
	 statusRE=HAL_UART_Receive(&huart3, alinanVeri,8, 50);
	 if(role==1)
	 {
	 HAL_GPIO_WritePin(GPIOC,GPIO_PIN_8,RESET);
	 }
	 //direksiyon açısını çıkar
	 //direksiyonAci=((alinanVeri[3]-'0')*10)+(alinanVeri[4]-'0');
	 //fren durumunu çıkar
	 //fren=alinanVeri[6]-'0';
	 //far değerini çıkar
	 //mode=(alinanVeri[1]-'0');
	 //sorun çıkmazsa
	 donme=0;
	 if(HAL_OK==statusRE)
	 {
	 //fren hareket edebilir
	 frenDur=0;
	 //direksiyon dönebilir
	 donme=0;
	 }
	osDelay(1);
}

/* USER CODE END funcUART */
}

Do you see this smiley in your posted code ?
It is there because you did not use code tags when posting the code

When you joined you will have been directed to read
https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

Please edit your post, add the code tags and always use code tags when posting code and error messages in future

In my experience the easiest way to tidy up the code and add the code tags is as follows

Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.