TFmini Plus code help for specific distance

I'm a complete beginner, I've watched a lot of videos and read a lot of posts/replies on this forum but I haven't found anything that is really helping me. I don't understand the code that I am using from GitHub for the TFmini Plus. I do understand the code for ultrasonic sensors a little better.
What I'm trying to accomplish is a yellow led comes on when the TF mini Plus senses a distance range of 10cm to 30cm, a green led on with a distance range of 33cm to 76cm, and a red led on with a distance range greater than 76cm. The respective led's go off when out of range.
Below is the code library I got from GitHub and I found out about this from a youtube video.

#include <SoftwareSerial.h>   //header file of software serial port
SoftwareSerial Serial1(2, 3); //define software serial port name as Serial1 and define pin2 as RX & pin3 as TX
 
int dist;                     //actual distance measurements of LiDAR
int strength;                 //signal strength of LiDAR
int check;                    //save check value
int i;
int uart[9];                   //save data measured by LiDAR
const int HEADER = 0x59;      //frame header of data package
 
 
void setup()
{
  Serial.begin(9600);         //set bit rate of serial port connecting Arduino with computer
  Serial1.begin(115200);      //set bit rate of serial port connecting LiDAR with Arduino
}
 
 
void loop() {
  if (Serial1.available())                //check if serial port has data input
  {
    if (Serial1.read() == HEADER)        //assess data package frame header 0x59
    {
      uart[0] = HEADER;
      if (Serial1.read() == HEADER)      //assess data package frame header 0x59
      {
        uart[1] = HEADER;
        for (i = 2; i < 9; i++)         //save data in array
        {
          uart[i] = Serial1.read();
        }
        check = uart[0] + uart[1] + uart[2] + uart[3] + uart[4] + uart[5] + uart[6] + uart[7];
        if (uart[8] == (check & 0xff))        //verify the received data as per protocol
        {
          dist = uart[2] + uart[3] * 256;     //calculate distance value
          strength = uart[4] + uart[5] * 256; //calculate signal strength value
          Serial.print("distance = ");
          Serial.print(dist);                 //output measure distance value of LiDAR
          Serial.print('\t');
          Serial.print("strength = ");
          Serial.print(strength);             //output signal strength value
          Serial.print('\n');
        }
      }
    }
  }
}

Too high for softwareserial.
Could you try with some ready made demo code first?

Thank you for replying!
Yes, I'm willing to try anything. Where do I find a "ready made demo code"?

Google is your friend.
Also read the documentation, if 115200 is the only or minimum baud rate for TF, it's not compatible with softwareserial.

https://learn.sparkfun.com/tutorials/tfmini---micro-lidar-module-hookup-guide/all

It is very important to state which Arduino you are using. There are many options for communicating with the TFmini-plus, but they depend on knowing what you have.

I'm using an Arduino Uno.

I have been all over Sparkfun looking for helpful information and I never found this, thank you!

Your'e welcome. Good luck!

The TFMini is a 3.3V device, so be sure to use the bidirectional logic level converter recommended by Sparkfun when connecting to the 5V Uno, following their examples.

Also, keep the following note from the Sparkfun tutorial example code in mind.

SoftwareSerial for some boards can be unreliable at high speeds (such as 115200).
The driver includes some limited error detection and automatic retries, that
means it can generally work with SoftwareSerial on (for example) an UNO without
the end-user noticing many communications glitches, as long as a constant refresh
rate is not required.

If the SoftwareSerial example doesn't work, I2C communications are a better choice. You will need the logic level converter for that too.

The I2C link is an updated code of the budryerson code I posted. The code I posted works but I don't know how to change it to measure specific distances or slow down to read the distances more accurately. The I2C code does not work with the TFmini PLUS and Arduino Uno and I don't know why. The code compiles/uploads but I get no readings.
Thanks for replying.

Are you using the required bidrectional logic level converters? Please post a wiring diagram.

For informed help, please read and follow the posting guidelines at "How to get the best out of this forum", linked at the head of every forum category.

I don't know how to change it to measure specific distances or slow down to read the distances more accurately.

To reduce measurement noise and increase accuracy, compute and print out the average of several distance measurements.

The TFMini Plus is, apparently, a 5V device - with 3V comms.
GitHub - TFmini/TFmini-Plus: Detailed introduction of TFmini-Plus