Today, I chose ultrasonic sensor and my intention was to make it buzz when some obstacles existed in front of the ultrasonic sensor. After I copied the code from the example, the serial monitor does not work as expected. I find out that the output pin was connected to the wrong number of the output. What`s more, I also connected another wire on the NC part. After I detected those errors, the serial monitor shows the exact distance between ultrasonic sensor.
Later, I connected the buzzer on the breadboard and it does not buzz as expected. I then switched to LED light and connected with a resistor. The LED light up when anything is too close to the ultrasonic sensor.
I still need to figure out how to use the buzzer successfully.