Connecting real car cluster with pc games (X-sim)

Hello friends,

Can anyone help me with this project posted on the forum.

The only thing needed is to configure the Arduino in X-yes, someone knows about it?

I’m desperate, just need it to complete the project.

int rpm;
int i;
int leds;
int Speed;
int fuel;
int ebrake;
int brake;
int fuelled;
int Turbo;
int gear;
int previous_potion = 0;
int rotate;

char kind_of_data;

void setup(){


 pinMode(2, OUTPUT);
 pinMode(3, OUTPUT);
 pinMode(5, OUTPUT);
 pinMode(7, OUTPUT);
 pinMode(8, OUTPUT);
 pinMode(10, OUTPUT);
 pinMode(12, OUTPUT);
 pinMode(13, OUTPUT);


void loop()
 //****************************** READ DATA FROM SERIAL ******************************
 while(Serial.available() > 0)

   kind_of_data =;
   if (kind_of_data == 'R' ) Read_Rpm();
   if (kind_of_data == 'S' ) Read_Speed();
   if (kind_of_data == 'F' ) Read_Fuel();
   if (kind_of_data == 'E' ) Read_EBrake();
   if (kind_of_data == 'B' ) Read_Brake();


 //****************************** READ DATA FROM SERIAL END ******************************

void  Read_Rpm(){

 int Rpm100 = '0';
 int Rpm10 = '0';
 int Rpm1 = '0';

 int rpm = 100*Rpm100 + 10*Rpm10 + Rpm1;
 if (rpm<135) digitalWrite(13,HIGH);
 if (rpm>135) digitalWrite(13,LOW);
 if (rpm>245) digitalWrite(8,HIGH);
 if (rpm<245) digitalWrite(8,LOW);


void Read_Speed(){

 int Speed100 = '0';
 int Speed10 = '0';
 int Speed1 = '0';

 Speed = 100*Speed100 + 10*Speed10 + Speed1;

 tone(12, map(Speed,127,255,0,950)); 


void Read_Fuel(){
 int Fuel100 = '0';
 int Fuel10 = '0';
 int Fuel1 = '0';

 fuel = 100*Fuel100 + 10*Fuel10 + Fuel1;

 if (fuel<135) digitalWrite(10,HIGH);
 if (fuel>135) digitalWrite(10,LOW); 


void Read_EBrake(){
 int EBrake100 = '0';
 int EBrake10 = '0';
 int EBrake1 = '0';

 ebrake = 100*EBrake100 + 10*EBrake10 + EBrake1;

 if (ebrake>200) digitalWrite(3,HIGH);
 if (ebrake<200) digitalWrite(3,LOW); 

void Read_Brake(){
 int Brake100 = '0';
 int Brake10 = '0';
 int Brake1 = '0';

 brake = 100*Brake100 + 10*Brake10 + Brake1;

 if (brake>200) digitalWrite(5,HIGH);
 if (brake<200) digitalWrite(5,LOW); 


Moderator edit:
</mark> <mark>[code]</mark> <mark>

</mark> <mark>[/code]</mark> <mark>
tags added.

We need more information to answer the question. I know about X-Plane but very little about X-Sim.

That code looks OK with no obvious problems, although the use of delay(1) is a bit of a hack and it won't be very reliable.

What are you trying to do? What equipment do you have? Do you have datasheets for any of that equipment? Have you tried running this code? What does it do? What would you like it to do differently?