Input Block-Examples
1)On Button Pressed:
This example counts how many times you press the A
 button. Each time you press the button, the LED screen shows the count
 variable getting bigger.
2)On Shake:
This program shows a number from 2
 to 9
 when you shake the micro:bit.
3)On Pin Pressed:
This program counts how many times you press the P0
 pin. Every time you press the pin, the program shows the number of times on the screen.
4)Button Is Pressed:
This program counts how many times you release the P0
 pin. Every time you release the pin, the program shows the number of times on the screen.
5)Acceleration:
6)Pin Is Pressed:
This program shows 1
 if P0
 is pressed, and 0
 if P0
is not pressed
7)Light Level:
a Number that means a light level from 0
 (dark) to 255
 (bright)
8)Compass Heading:
This program finds the compass heading and then shows a letter that means whether the micro:bit is facing north (N), south (S), east (E), or west (W).
9)Temperature:
The following example uses temperature
 and show number
to show the temperature of the room.
11)on Sound:
This program shows a icon from when the sound is loud.
11)on Logo Pressed:
This program shows a string when logo is pressed.
12)logo Is Pressed:
This program shows a string If logo is pressed otherwise it clear the screen.
13)sound Level:
This program shows a icon If sound level is greater than the number otherwise clears the screen.
14)Rotation:
This program helps you move the micro:bit until it is level. When it is level, the micro:bit shows a smiley.
If you are running this program in a browser, you can tilt the micro:bit with your mouse.
15)Magnetic Force:
Create a metal detector my measuring the strength of magnetic force in the X
direction. Display a bar graph to show the current level of magnetic force measured by the magnetometer.
16)Running Time:
When you press button B
on the micro:bit, this program finds the number of milliseconds since the program started and shows it on the LED screen.
Running Time ms:
17)Running Time Micros:
When you press button B
on the micro:bit, this program finds the number of micros since the program started and shows it on the LED screen.
18)Calibrate Compass:
19)On Pin Released:
20)Set Accelerometer Range:
21)set Sound Threshold: