Case 6丨I2C (Integrated Circuit Bus)
November 11, 2022How to use BLE to remote control the micro:bit car?
November 25, 2022Story
Legend has it that on the night of December 24, Father Christmas flies through the sky on a sleigh pulled by nine reindeer, goes from house to house down the chimney, and quietly places presents in a stocking on a child’s bed or under the Christmas tree by the fireplace.
Case Introduction
The sleigh car is the exclusive ride of Father Christmas. The work uses an ultrasonic sensor as a deer, a pair of deer feet with small pellets, a tiller to drive the deer’s feet, and an MP3 sensor at the rear of the car as a body stereo. Father Christmas is wearing presents.
Equipment Required
List
Assembly Steps
Two 1×15 blocks with perforated arms are inserted with 1×2 friction pins into a 5×7 block with perforated arms as shown in the diagram.
Insert two 20-tooth gears into a 1×15 arm block with a 1×1 cross bushing.
Two 9-hole arms and two 7-hole arms are inserted into the 20-tooth tines, using the peg connectors as the four feet of the fawn.
As shown in the picture: add a 5×7 arm circle block in the middle.
The ultrasonic sensor is held in place using two 1×2 friction pins, which act as the eyes of the Christmas deer.
Fixing 1×5 arm with hole and 3×5 H-arm.
Make a pair of antlers using the peg connector, half cross shaft half peg, 4# 135° cross shaft connector, and cross shaft connector.
Insert the 10# cross shaft inside the middle of the 5×7 arm ring
Fix the motor with the 8 rainbow light rings and the deer is ready.
Two 1×15 perforated arms are used on both sides.
Fixed with two 7# cross shafts.
Linking the deer to the Christmas car.
Christmas sleigh front mounted 3×7 with axle bolt hole double bent 45° arm.
Christmas sleigh rear mounted 3×7 with axle bolt hole double bent 45° arm.
Christmas sleigh fitted with four gears.
Installation of the motor.
Install the MP3.
5×7 holes for arm ring fixing.
Install Nezha expansion board and micro:bit
Finally, the sleigh and the deer are ready.
micro:bit PROGRAMMING
Now we start programming the case, using the deer to walk automatically and play Christmas music.
Step 1
Set M1 for the deer motor speed of 50%, and M2 for the Christmas Christmas sleigh car motor at 40%, the deer will walk more slowly, so set it a little slower than the sleigh car, when the micro:bit motherboard A key is pressed, the deer and Christmas sleigh car at the same time to start, B key is pressed to stop the motor, hand out gifts.
Step 2
Set a variable strip, which will be 8 rainbow light rings set pin J1 to initialize the lights with 8 LEDs. set the MP3 connection port for J2, and set a variable I for the volume level of MP3, through the voice recognition module to control the MP3 module to play music, in advance of the Christmas music downloaded into the MP3. (Note: the folder name must be two digits 01 ~ 99, such as 01 )
Step 3
Set up an infinite loop, variable trip loop pixel offset 1, trip refresh display, MP3 volume size I.
Display
Results
Once you have downloaded the program, the complete Christmas block sleigh car and block deer are ready, come and hand out presents with Santa.