Welcome to Raspbot V2 repository
当製品の日本語版マニュアル資料は、こちらからご取得ください。
6.Printing ultrasonic data
6.Printing ultrasonic data
6.Printing ultrasonic data1. Learning objectives2. Experimental preparation3. Core code analysis4. Experimental phenomenon
1. Learning objectives
Control the ultrasonic switch connected to the expansion board and print the distance measurement data.
2. Experimental preparation
As shown in the figure below, connect the ultrasonic to the expansion board.

3. Core code analysis
Raspbot_Lib library functions required to control ultrasonic distance measurement:
xCtrl_Ulatist_Switch(state)
Parameter explanation: state=0: turn off the distance measurement function, state=1: turn on the distance measurement function.
Return value: None.
Source code path: project_demo\03.Basic_car_course
4. Experimental phenomenon
Turn on the robot, open the computer browser and enter the Jupyter lab editor
Enter the source code path and double-click the code to be run

Restart the kernel and clear all outputs

Click the first code block, then click the run button to start running one by one

After the program runs, as the code blocks run, we can turn on or off the ultrasonic ranging function, and print the ultrasonic ranging data at the bottom of the program, and the ranging data will also be displayed on the oled screen.