Welcome to Raspbot V2 repository
当製品の日本語版マニュアル資料は、こちらからご取得ください。
2.Key reading
02. Key reading
02. Key reading1. Learning objectives2. Experimental preparation3. Core code analysis4. Experimental phenomenon
1. Learning objectives
Read the pressed state of key KEY1.
2. Experimental preparation
As shown in the figure below, key KEY1 is an onboard component, so no external devices are required.

3. Core code analysis
To read the pressed state of a key, we judge by reading the data at address 0x0d:
read_data_array(0x0d, 1)
Parameter explanation: Read the status data of a key
0x0d: the address of the key, 1: read 1 byte.
Return value: 0: means the key is not pressed, 1: means the key is pressed.
Source code path: project_demo/03.Basic_car_course
4. Experimental phenomenon
Turn on the robot, open the computer browser to enter the Jupyter lab editor
Enter the source code path, 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 block runs, we press the KEY1 button on the car, and a prompt will appear on the jupyter lab as shown below
