# micro : bit Block Guide ## micro:bit V2 Mainboard ### Matrix #### Display Image ( ) ![](IMG/M1.png) Used to display the specified pattern from the drop-down list on the micro:bit mainboard. Example: ![](IMG/M2.png) #### Display Icon ( ) ![](IMG/M3.png) Used to display manually drawn patterns on the micro:bit mainboard Example: ![](IMG/M4.png) #### Display String ( ) ![](IMG/M5.png) Used to display the input string on the micro:bit mainboard. Example: ![](IMG/M6.png) #### Scroll Display String ( ) ![](IMG/M7.png) Used to scroll and display the string on the micro:bit mainboard. Example: ![](IMG/M8.png) #### Set Pixel x( ) y( ) Brightness ( ) ![](IMG/M9.png) Allows you to set the brightness of the pixel at coordinates x, y. Example: ![](IMG/M10.png) #### Clear Display ![](IMG/M11.png) Clears the display content on the dot matrix. Example: ![](IMG/M12.png) ### Sensor #### When Button ( ) Pressed ![](IMG/M13.png) Check if the selected button is pressed. Example: ![](IMG/M14.png) #### Brightness ![](IMG/M15.png) Returns the current environmental brightness. Example: ![](IMG/M16.png) #### Temperature ![](IMG/M17.png) Returns the current environmental temperature. Example: ![](IMG/M18.png) #### Sound ![](IMG/M19.png) Returns the current environmental sound. Example: ![](IMG/M20.png) #### Compass Calibrate ![](IMG/M21.png) Calibrate the internal compass of the micro:bit. Example: ![](IMG/M22.png) #### Compass Heading ![](IMG/M23.png) The micro:bit has a compass sensor that can measure its orientation or azimuth angle based on magnetic north. Example: ![](IMG/M24.png) #### Magnetic Strength( ) ![](IMG/M25.png) You can use the compass as a magnetometer to measure the magnetic field strength. It can do this in 3 dimensions and can simultaneously measure the overall magnetic field strength in all dimensions. ![](IMG/M26.png) Example: ![](IMG/M27.png) #### **( ) Gesture** ![](IMG/M28.png) Determines whether a specific gesture is detected. Example: ![](IMG/M29.png) #### Acceleration ( ) ![](IMG/M30.png) Get the acceleration along the three axes (X, Y, Z). Example: ![](IMG/M31.png) ### Music #### Play Music( ) ![](IMG/M32.png) Play the selected music Example: ![](IMG/M33.png) #### Set Playback Speed ( ) ![](IMG/M34.png) You can set the rhythm or speed of the music played on the micro:bit: Example: ![](IMG/M35.png) #### Tone Frequency ( ) Continuous Play ![](IMG/M36.png) The micro:bit can play sounds defined by frequency or pitch. Example: ![](IMG/M37.png) #### Stop Continuous Play ![](IMG/M38.png) Stop Continuous Sound Playback Example: ![](IMG/M39.png) #### 语音 说() ![](IMG/M40.png) Control the micro:bit to speak the input text using speech. Example: ![](IMG/M41.png) #### Play Expressive Sound ( ) ![](IMG/M42.png) Control the micro:bit to play expressive sounds. Example: ![](IMG/M43.png) #### Set Volume( ) ![](IMG/M44.png) Set volume of the sound played Example: ![](IMG/M45.png) #### ( )Speaker ![](IMG/M46.png) Turn Off/On the Speaker Example: ![](IMG/M47.png) ## micro:bit V2 Peripheral #### Long Range Photoelectric Sensor ( ) ![](IMG/M48.png) Get the value of the long-distance photoelectric sensor Example: ![](IMG/M49.png) #### Potentiometer ( ) ![](IMG/M50.png) Get the potentiometer's return value Example: ![](IMG/M51.png) #### Gray Level Sensor( ) ![](IMG/M52.png) Get the grayscale sensor value Example: ![](IMG/M53.png) #### Photosensitive Sensor ( ) ![](IMG/M54.png) Get the photosensitive sensor value Example: ![](IMG/M55.png) #### Flame Sensor ( ) ![](IMG/M56.png) Get the flame sensor value. Example: ![](IMG/M57.png) #### Water Level Sensor( ) ![](IMG/M58.png) Get the water level sensor value. Example: ![](IMG/M59.png) #### MQ-2 Gas Sensor ( ) ![](IMG/M60.png) Get the MQ-2 gas sensor value. Example: ![](IMG/M61.png) #### Soil Moisture Sensor ( ) ![](IMG/M62.png) Get the soil moisture sensor value. Example: ![](IMG/M63.png) #### Temperature Sensor ( ) ![](IMG/M64.png) Get the temperature sensor value. Example: ![](IMG/M65.png) #### Hall Sensor ( ) ![](IMG/M66.png) Get the hall sensor value. Example: ![](IMG/M67.png) #### Button Sensor ( ) ![](IMG/M68.png) Get the button sensor value. Example: ![](IMG/M69.png) #### Ultrasonic Sensor (P13, P0) Unit cm ![](IMG/M70.png) Get the value obtained by the ultrasonic sensor. Example: ![](IMG/M71.png) #### Detect Rocker( ) ![](IMG/M72.png) Determine the direction of the detected joystick. Example: ![](IMG/M73.png) #### Rocker ( ) Direction ![](IMG/M74.png) Return the detected joystick direction. Example: ![](IMG/M75.png) ### Action #### Servo ( ) Angle ( ) ![](IMG/M76.png) Control the servo to rotate to a specific angle. Example: ![](IMG/M77.png) #### Motor ( ) Angle ( ) ![](IMG/M78.png) Control the Motor to Rotate at a Specified Speed Example: ![](IMG/M79.png) #### Fan ( ) Switch to ( ) ![](IMG/M80.png) Control the Fan to Toggle Between On/Off States Example: ![](IMG/M81.png) #### Electromagnet ( ) Switch to ( ) ![](IMG/M82.png) Control the Electromagnet to Toggle Between On/Off States Example: ![](IMG/M83.png) #### Read( )Motor Position ![](IMG/M84.png) Get the position of different motors. Example: ![](IMG/M85.png) #### **Left Motor Set to ( ) Right Motor Set to ( )** ![](IMG/M86.png) Assign different colors to different motors Example: ![](IMG/M87.png) #### Dual Motors at ( ) ( ) Speed Rotate ( ) Seconds ![](IMG/M88.png) Control each motor in the dual motor setup to rotate at the specified speed for a given time. Example: ![](IMG/M89.png) #### Dual Motors at ( ) ( ) Speed Rotate ( ) Degrees ![](IMG/M90.png) Control Each Motor in Dual Motor Setup to Rotate at a Specified Speed for a Given Angle Example: ![](IMG/M91.png) #### Dual Motors at ( ) ( ) Speed Rotate ![](IMG/M92.png) Control Each Motor in Dual Motor Setup to Rotate Continuously at Given Speed Example: ![](IMG/M93.png) #### Motor at ( ) Speed Rotate ( ) Degrees ![](IMG/M94.png) Control different colored motors to rotate at a given speed and a specified angle. Example: ![](IMG/M95.png) #### ( ) Motor at ( ) Speed Rotate ( ) Seconds ![](IMG/M96.png) Control different colored motors to rotate at a given speed for a specified time. Example: ![](IMG/M97.png) #### ( ) Motor at ( ) Speed Go to ( ) Position ![](IMG/M98.png) Control the specified motor to rotate at a given speed to a specified position. Example: ![](IMG/M99.png) #### ( ) Motor at ( ) Speed Rotate ![](IMG/M100.png) Control the motor of a specified color to rotate at a specified speed. Example: ![](IMG/M101.png) ### Light & Sound #### LED( )Switch to ( ) ![](IMG/M102.png) Control LED to toggle between on/off states. Example: ![](IMG/M103.png) #### Light Ring ( ) Set Brightness ( ) ![](IMG/M104.png) Set the brightness of the specified light ring. Example: ![](IMG/M105.png) #### Light Ring ( ) Display Color ( ) ![](IMG/M106.png) Set the specified light ring to display a color. Example: ![](IMG/M107.png) #### Initialize OLED ![](IMG/M108.png) Used to initialize the OLED module. Example: ![](IMG/M109.png) #### Display Text ( ) at X ( ) Y ( ) with Color Mode ( ) ![](IMG/M110.png) Set the text content, display position, and display mode. Example: ![](IMG/M111.png) #### Clear OLED ![](IMG/M112.png) Clear the OLED display. Example: ![](IMG/M113.png) #### Laser ( ) Switch to ( ) ![](IMG/M114.png) Control the laser module to switch between on and off states Example: ![](IMG/M115.png) #### Recording Module-Play( ) ![](IMG/M116.png) Control the Recording Module to Play a Specified Sound. Example: ![](IMG/M117.png)