Hello all, how do I solve ovf bcos after the reciever print the float value it continously print the ovf. Please help

//here is the code for sender
#include <SoftwareSerial.h>

SoftwareSerial SerialSend(11, 10); //RX, TX
float gps= 14.5115569;
void setup() {
  Serial.begin(9600);
  SerialSend.begin(9600);
}


void loop() {
  SerialSend.write((uint8_t *)(&gps), sizeof(gps));
  Serial.println(gps, 7);
}


//here is the code for reciever
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); //RX, TX

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

void loop() {  
  const uint8_t numFloatBytes{sizeof(float)};
  char tempBuffer[numFloatBytes];
  float floatvalue;
  for(uint8_t i = 0; i < numFloatBytes; i++){
    tempBuffer[i] = mySerial.read();
  }
  memcpy((void *)&floatvalue, tempBuffer, numFloatBytes);
  Serial.println(floatvalue, 7);
  delay(1000);
}```

The write() method of the SoftwareSerial class takes a byte, not an int as an argument hence the truncation.

Welcome to the forum

It is bad enough when a user posts a screenshot of code, but 4 in 1 is a new low

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.