Sugar - Collision Module
Introduction
Function
Signal
Digital output 1 (high level): module switch is in contact 0 (low level): module switch is not in contact
Module principle
The module uses a touch switch. When the switch is closed, the circuit generates a high-level signal
Wiring
Future Board Lite Interface | Wiring | |||
---|---|---|---|---|
Sugar Cube Collision Module | Port3 | White PH2.0-3Pin Interface Cable |
warning: Supports connecting to Port1, Port2, Port3, Port4 When programming, make sure that the interface is consistent with the actual use
Blocks - Function Description
No. | Block Image | Block Function |
---|---|---|
1 | Detects whether the collision sensor is pressed |
Program - Features
- Set the color screen to dot matrix mode
- Initialize the variable, responsible for recording the number of times the collision sensor is pressed
- Cyclic detection
- When the collision sensor is detected to be pressed
- Display a smiley face picture once, and increase X, then display X on the dot matrix screen
- When the collision sensor is not detected as pressed, the dot matrix screen displays a sad face
Using Kittenblock
Using the offline download mode to run the program to check the effects
Using Robotbit on Microbit
Programming Platform
Microsoft MakeCode for micro:bit Use the Makecode programming platform
Add the Sugar plugin
Search for Sugar in the extensions, click Add
Circuit Connection
Microbit Interface | Line | |||
---|---|---|---|---|
Sugar Cube Collision Module | P0 | White PH2.0-3Pin Interface Line |
warning Support connection at P0, P1, P8, P13, etc. Keep the interface consistent with the actual one during programming
Blocks - Function Description
No. | Block Image | Block Function |
---|---|---|
1 | Reads whether the collision module is collided with |