The selflocking switch is a common use button switch. When we fisrt press the button and the circuit of switch will be connection, it means selflock. And when we press the button again, the circuit of switch will be disconnection. In this case, we are going to use the selflocking switch to control on and off of the LED.
The selflocking switch is usually a normal switch with a mechanical lock built in. When pressed down and released, it doesn’t bounce back automatically. Only after a second press will it unlock and fully release.
The experiment box included a selflocking button with a red hat.
Note: Please note the positive and the negative when you are connecting.
Snap the set pin block into the on start to emit the edge events. Then, set pull pin P0 to up to set a default high level and to detect the edge of the level fluctuation.
Every time you press the button, the voltage of P0 port P0 changes. From 0V to 3.3 V, we call this RISE. From3.3V to 0V, we call this FALL.