I searched it online, it looks like this way for Rasberry Pi, but not Sunfounder Picar 4wd Hat. I am afraid of a short-circuit or something, so I want to double check it. Thank you very much!
It can be connected to the PWM pin of the robot hat, connected to 5V and GND (the positive pole is connected to 5V, and the negative pole is connected to GND)