MakerFocus TFmini-s Micro Lidar Module Initializing forever

Hello and hope all is well with you guys.
I bought a MakerFocus TFmini-s Micro Lidar Module to teach myself about LIDAR. I bought it from the Amazon link below.

I ran the code that I got from:
https://learn.sparkfun.com/tutorials/tfmini---micro-lidar-module-hookup-guide/all

The code is at the end of this post.

BTW:

  1. I am using an ELEGOO Mega.
  2. The RX line from the LIDAR is going into Pin 2.
  3. The TX line from the LIDAR is going into Pin 3.
  4. The LIDAR is pointing at the ceiling which is about 6 feet from the LIDAR.

The problem I have is, that the Serial monitor just says, :"Initializing...' and nothing happens.

Can you guys please tell me how to proceed?
Thank you

#include <SoftwareSerial.h>
#include "TFMini.h"

// Setup software serial port 
SoftwareSerial mySerial(2,3);      // Uno RX (TFMINI TX), Uno TX (TFMINI RX)
TFMini tfmini;

void setup() {
  // Step 1: Initialize hardware serial port (serial debug port)
  Serial.begin(115200);
  // wait for serial port to connect. Needed for native USB port only
  while (!Serial);
     
  Serial.println ("Initializing...");

  // Step 2: Initialize the data rate for the SoftwareSerial port
  mySerial.begin(TFMINI_BAUDRATE);

  // Step 3: Initialize the TF Mini sensor
  //tfmini.begin(mySerial);
  tfmini.begin(&mySerial);    
}


void loop() {
  // Take one TF Mini distance measurement
  
  uint16_t dist = tfmini.getDistance();
  uint16_t strength = tfmini.getRecentSignalStrength();


  // Display the measurement
  Serial.print(dist);
  Serial.print(" cm      sigstr: ");
  Serial.println(strength);

  // Wait some short time before taking the next measurement
  delay(25);  
}

What is the primary obstacle?

The sparkfun video showed the Serial Monitor display how far a certain object was;every 1 second. My serial monitor just says Initializing forever. When I hit the reset button on the MEGA, the Serial Monitor prints the time and says 'Initializing...'.
It is almost like it is frozen or something.

Okey.
Then that device is not responding. Focus on that, power, connections, code.

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