FAQ

How to code an ultrasonic sensor in Arduino?

userHead Tonny12138 2024-12-18 15:22:38 1096 Views2 Replies

How to code an ultrasonic sensor in Arduino?

2024-12-18 15:28:56

You can refer to the following link:

https://wiki.dfrobot.com/URM09_Ultrasonic_Sensor_(Gravity_Analog)_SKU_SEN0307

 

userHeadPic yiqing.guan
2024-12-18 15:24:39

The product's wiki contains corresponding usage instructions and sample codes. It is recommended to refer to the wiki for code writing and product use.

Taking the "Gravity: URM09 Analog Ultrasonic Sensor" (SKU: SEN0307) as an example, it uses an analog voltage output method and can be connected to the mainboard through the Gravity 3Pin analog sensor cable. The module is connected to the UNO through the A1 analog interface, as shown in the figure below.

 

 

Tutorial on Arduino programming ( Distance Measurement )

The module will output analog voltage proportional to distance. After ADC sampled and output these data, the distance value can be obtained with a simple processing step.

 

Sample Code

userHeadPic Tonny12138