Skip to main content

WuKong2040 Libraries Explanations

Functions DefinitionItemParameterReturn Value
wukong2040 on-board function libraryWuKong2040NoImporting on-board function methods and properties
Method for determining whether the status of key A, key B or key AB has been pressedbutton_is_pressed(button:"ButtonA")button:
Parameter type: str
Default Parameter:"ButtonA"
Parameter Range:
Pressing a key returns True, otherwise it returns False
Drive motors M1/M2/M3/M4motor(m:"M1", speed:0)m:
Parameter type: str
Default Parameter: "M1"
Parameter Range: "M1"\"M2"\"M3"\"M4"
Parameter type: int
Default Parameter: 0
Parameter Range: 0~100
Driving rainbow lights to show coloursrainbow_led(n:"all", r:0, g:0, b:0)n:
Parameter type: str
Default Parameter: "all"
Parameter Range: "0"\"1"\"all"
Drive buzzer Built-in music, calling up the built-in music names.
For example: music.DADADADUM
2. Melody array, a user-defined array of music codes.
For example: notes = ['c4:1', 'e', 'g']