Welcome to Building:bit Superkit repository
3.6 Spiders sense human body
Spiders sense human body
Spiders sense human body1. Learning Objectives2. Building Blocks3. Sensor Wiring4. Programming4.1 Adding extension packs4.2 Building blocks used4.3 Combining blocks5. Experimental phenomenon
1. Learning Objectives
In this course, we mainly learn how to use MakeCode graphical programming to realize the function of the spider automatically sensing the human body behind and escaping.
2. Building Blocks
For the building block steps, please refer to the installation drawings of [Assembly Course]-[Fleeing spider] in the materials or the building block installation album.
3. Sensor Wiring
The motor wiring on the left side of the car is inserted into the M1 interface of the Super:bit expansion board, and the black line is close to the battery side;
The motor wiring on the right side of the car is inserted into the M3 interface of the Super:bit expansion board, and the black line is close to the battery side;
The human infrared sensor module is connected to the P1P2 interface.

4. Programming
Method 1 Online Programming:
First, connect micro:bit to the computer via a USB data cable. The computer will pop up a U disk. Click the URL in the U disk: https://makecode.microbit.org/ to enter the programming interface. Then, add the Yahboom software package https://github.com/YahboomTechnology/SuperBitLibV2 to start programming.
Method 2 Offline Programming:
Open the offline programming software MakeCode and enter the programming interface. Click [New] and add the Yahboom software package https://github.com/YahboomTechnology/SuperBitLibV2 to start programming.
4.1 Adding extension packs


4.2 Building blocks used
The locations of the building blocks required for this programming are shown in the figure below.




4.3 Combining blocks
The summary program is shown in the figure below.

You can also directly open the Spiders-sense-human-body.hex file provided in this experiment and drag it into the browser that opens the URL, and the program diagram of this project source code will be automatically opened.
5. Experimental phenomenon
After the spider is powered on, the microbit mainboard will display 0 after initialization. When the human infrared module detects an obstacle behind it, the dot matrix displays 1 and the spider moves forward for 2 seconds. Otherwise, the spider is in a motionless state and the microbit mainboard displays 0.