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:
- I am using an ELEGOO Mega.
- The RX line from the LIDAR is going into Pin 2.
- The TX line from the LIDAR is going into Pin 3.
- 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);
}