I need a help about RS485

Hi,
I want to transfer the speed, which is calcucated on master, to the slave and display on LCD.
I’ve tried but the data type of the speed is float so i can’t transmit it through rs485
Do anyone have idea for it?
Here is my code for calculate speed on master

#define PIN_DO 2
volatile unsigned int pulses;
float mps;
unsigned long timeOld;
#define HOLES_DISC 20

void counter()
{
  pulses++;
}

void setup() 
{ 
  Serial.begin(9600); 
  pinMode(PIN_DO, INPUT);
  pulses = 0;
  timeOld = 0;
  attachInterrupt(digitalPinToInterrupt(PIN_DO), counter, FALLING); 
  
} 
 
void loop() 
{ 
 if (millis() - timeOld >= 1000)
  {
    detachInterrupt(digitalPinToInterrupt(PIN_DO));
    float mps = 10 * (pulses * 0.065 * 3.14) / (HOLES_DISC);  
    delay(100);
    timeOld = millis();
    pulses = 0;
    attachInterrupt(digitalPinToInterrupt(PIN_DO), counter, FALLING); 
}
}

…and my slave

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 6, 5, 4, 3);

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

  lcd.begin(16, 2);
  lcd.setCursor(0,0);
  lcd.print("Van toc: ");
  lcd.setCursor(10,1);
  lcd.print("m/s");

} 
 
void loop() 
{ 
// the message received from rs485 is [b]mps[/b]
  lcd.setCursor(0,1);
  lcd.print(mps);
                 
}

I've tried but the data type of the speed is float so i can't transmit it through rs485

Nonsense. 4 bytes is 4 bytes.

    detachInterrupt(digitalPinToInterrupt(PIN_DO));
    float mps = 10 * (pulses * 0.065 * 3.14) / (HOLES_DISC); 
    delay(100);
    timeOld = millis();
    pulses = 0;
    attachInterrupt(digitalPinToInterrupt(PIN_DO), counter, FALLING);

So, during the time that you have your head stuck in the sand, pulses don't matter?

Nowhere do you actually attempt to send, or receive, the data. Why not?

here's a suggestion:
get your program working such that you can send the float to the serial monitor as text, then
see if you can ALSO send it out to the slave as text and make it appear on the slave'sdisplay and/or the serial monitor of the slave.

hints: sprintf(), serial.println(), serial1.println() for your master
serial1.read(), serial1.available() for your slave

( or use SoftwareSerial in lieu of Serial1 if you must)

there are other ways to do this, of course.

I’ve tried with Serial.println() but it doesn’t still work

Master

#define PIN_DO 2
volatile unsigned int pulses;
float mps;
unsigned long timeOld;
#define HOLES_DISC 20

void counter()
{
  pulses++;
}

void setup() 
{ 
  Serial.begin(9600); 
  pinMode(PIN_DO, INPUT);
  pulses = 0;
  timeOld = 0;
  attachInterrupt(digitalPinToInterrupt(PIN_DO), counter, FALLING); 
  
} 
 
void loop() 
{ 
 if (millis() - timeOld >= 1000)
  {
    detachInterrupt(digitalPinToInterrupt(PIN_DO));
   
    float mps = (pulses * 0.065 * 3.14159265358979) / (HOLES_DISC);  
    Serial.println(mps);
    delay(100);
    timeOld = millis();
    pulses = 0;
    attachInterrupt(digitalPinToInterrupt(PIN_DO), counter, FALLING); 
}
}

Slave

#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 6, 5, 4, 3);



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

  lcd.begin(16, 2);
  lcd.setCursor(0,0);
  lcd.print("Van toc: ");
  lcd.setCursor(10,1);
  lcd.print("m/s");
 
} 
 
void loop() 
{ 
  
  float nhan;
 if (Serial.available() > 0) {
    nhan = Serial.read(); 
  }
  lcd.setCursor(0,1);
  lcd.print(nhan);
                 
}

I've tried with Serial.println() but it doesn't still work

When you uploaded the code, did the Arduino stick up a picket sign, and refuse to work under these conditions? Or, did the Arduino actually run the code, but not match your expectations in terms of its behavior?

If the first is the case, get a union buster to hire lower paid workers.

If the second is the case, adjust your expectations. Or change the code so that it does match your expectations. Don't expect us to help, though, when all you do is whine "It doesn't work".

You are still sticking your head in the sand for a significant amount of time.