Using serial communication

So sorry for the hassle. I did say that I was not real familiar with the parseFloat() function. I never use that sort of function as I like to use the methods from Robin2's serial input basics to read serial.

I did a search for how to use parseFloat() and found that you need to use:
while (Serial.available() == 0);
to wait for input and also to extend the serial timeout to give more time for input:
Serial.setTimeout(10000);
I also clear the serial input buffer in between entering the 2 values. Not sure that it is necessary, though.

With those changes it seems to work.

#include <DFRobot_TFmini.h>
#include <SoftwareSerial.h>

SoftwareSerial mySerial(8, 7);

DFRobot_TFmini TFmini;

uint16_t strength;

int  j, k = 0;
int n;
float x, y, z;
float R, r, ang, w, tot_ang, und_ang;

// sampled along radius = R

void setup()
{
   Serial.begin(9600);
   Serial.setTimeout(10000); // timeout = 10 sec.

   Serial.println("Data required");

   Serial.print("R = ");
   while (Serial.available() == 0);   
   float R = Serial.parseFloat();   Serial.println(R);
   
   // clear receive buffer   
   while (Serial.available() > 0)
   {
      Serial.read();
   }
   
   Serial.print("w = ");
   while (Serial.available() == 0);   
   float w = Serial.parseFloat();
   Serial.println(w);

   Serial.print("Sensor moving along the radius of ");
   Serial.println(R);
   Serial.print("Sensor moving on the wheel radius of ");
   Serial.println(w);
   tot_ang = (2 * PI * R) / w;
   und_ang = 2;
   n = tot_ang / und_ang;
   TFmini.begin(mySerial);
}

void loop()
{
}