- Initialize matrix keyboard pins SCL, SDO
- Implement Micro:bit to read and display keyboard value
- Sample program
- Use two pins to get the value, hit to display the corresponding letter or number
- Detect if touched by pin
- Sample program
- When the module is touched, it will show a smiley face, otherwise it will show a sad face
- Detect whether the key is pressed by the pin
- Sample program
- When the button is pressed, the smiley emoji will be displayed, otherwise the sad emoticon will be displayed
- Detect collision by pin
- Sample program
- A happy emoji is displayed when a collision occurs, and a sad emoticon is displayed when it does not occur
- Get the current resistance value of the varistor (1~100) through the pin
- Sample program
- Display the current resistance value of the sliding rheostat, and update the value every second
- Get the current voltage value of the rotary potentiometer through the pin
- Sample program
- Display the voltage value of the current rotating potentiometer, update the value every second
- Initialize pins X, Y, B
- Get analog value via pin X/Y
- Determine if the button is pressed
- Sample program
- When the joystick is pushed up/down/left/right, the LED dot matrix screen will print up/down/left/right patterns. When the joystick is pressed, the LED dot matrix screen will print a happy expression.
- Initialize pins CLK, DIO
- Implement whether to play the piano
- Sample program
- By touching different keys, different music will be generated
- Initialize pins CLK, DIO
- Implement whether to play the piano
- Sample program
- By touching different keys, different music will be generated
- The PH2.0 handle is connected to the I2C pins by default (ie P19, P20), the following code achieves the effect of PH2.0
- Get controller button state
- Get the value of the X/Y axis
- Determine if the handle button is released
- Determine if the handle button is pressed
- Sample program
- Get the value of the X/Y axis. After 1 second, the function of judging the state of each button can be realized. If it is pressed, it will display a crying face, and when it is released, it will display a smiling face
- Get the water vapor concentration in the environment through the pin
- Sample program
- Display the water vapor concentration value, which is updated every second
- Get ambient temperature through pin
- Sample program
- Display the ambient temperature value and update the display every second
- Judging that there is flame around by the digital value obtained from the pin
- Get the analog value of the flame through the pin
- Sample program
- Judging whether there is a flame around, if there is an analog value to display the flame, if it does not exist, it will display a smiley face.
- Determine if there is a black wire by the pin
- Sample program
- If the infrared tracking sensor senses a black line, it will display a crying face, otherwise it will display a smiling face
- Judging whether it is tilted by the pin
- Sample program
- When the tilt sensor senses tilt, it will show a crying face, otherwise it will show a smiling face
- Get the analog value of the light intensity sensed by the light sensor in the environment through the pin
- Sample program
- Displays an analog value of light intensity, updating the display every second
- Get heat value by pin
- Sample program
- Display the ambient heat value, update the display every second
- Get water depth value via pin
- Sample program
- Display the water depth value, which is updated every second
- Get soil moisture value via pin
- Sample program
- Display soil moisture value, update display every second
- Get the digital value through the pin to determine whether there is an obstacle ahead
sample program
- Determine whether there is an obstacle in front of you, if there is a crying face, if not, a smiling face is displayed
- Get the digital value through the pin to determine whether there is a magnetic field around
- Sample program
- The reed switch sensor senses whether there is a magnetic field around it, and if it exists, it will show a sad face, and if it does not exist, it will show a smiling face
- Realize the function of obtaining the digital value obtained by the human body heat source sensor through the pin, thereby judging whether there is an ambient heat source around
- Sample program
- Determine whether there is a human body heat source around, if it exists, it will show a crying face, if not, it will show a smiling face
- The vibration sensor is a 4Pin sensor, the D port connected is used to detect whether vibration (digital value) is detected, and the Pin port connected to the A port is used to read the analog value.
- Get shock sensor analog value via pin