Connect XV-11 Lidar to Arduino Mega


I hope Im in the correct forum.

I do not understand how to connect lidar's motor (those two together braided cables) to arduino. This is how lidar's pins look like:

My initial idea was to plug in motor's red pin to 5V and black to ground but I have been reading more about motors and I found out that other people are using transistors and resistors (next picture).

I do not understand why they use transistors and resistors. Can anyone please explain it to me? I would really appreciate it. Since lidar is not mine, I really do not want to burn anything. This is why I am so hesitant even trying out to run lidar.

My initial goal is to power up lidar from USB from my computer and read data from it using TX/RX.

Did you ever get this working?

I have ordered the resistor and diode but not sure what the IPS041L Mosfet switch is for