@@ -10,7 +10,7 @@ sidebar_label: wokwi-pushbutton
10
10
## Pin names
11
11
12
12
| Name | Description |
13
- | ----------- | ------------------------------- |
13
+ | --------- | ----------------------------- |
14
14
| 1.l / 1.r | First contact (left / right) |
15
15
| 2.l / 2.r | Second contact (left / right) |
16
16
@@ -32,8 +32,9 @@ that pin as `INPUT_PULLUP`, and the other contact (e.g. `2.r` or `2.l`) to the g
32
32
## Attributes
33
33
34
34
| Name | Description | Default value |
35
- | -------- | ------------------------------------ | --------------- |
35
+ | ------ | ---------------------------------- | ------------- |
36
36
| color | The color of the push button | "red" |
37
+ | xray | Show internal wiring: "1" or "" | "" |
37
38
| label | Text that appears below the button | "" |
38
39
| key | Keyboard shortcut for button | |
39
40
| bounce | Set to "0" to disable bouncing | "" |
@@ -88,31 +89,32 @@ This is useful when you need multiple buttons pressed at the same time.
88
89
### Examples
89
90
90
91
| Result | Attrs |
91
- | --------------------------------------- | --------------------------- |
92
+ | ------------------------------------- | ------------------------- |
92
93
| <wokwi-pushbutton color =" green " /> | ` { "color": "green" } ` |
93
94
| <wokwi-pushbutton color =" #FFFF00 " /> | ` { "color": "#FFFF00" } ` |
94
95
| <wokwi-pushbutton label =" Push me! " /> | ` { "label": "Push me!" } ` |
96
+ | <wokwi-pushbutton xray =" 1 " /> | ` { "xray": "1" } ` |
95
97
96
98
## Automation controls
97
99
98
100
The pushbutton can be controlled using [ Automation Scenarios] ( ../wokwi-ci/automation-scenarios ) . It exposes the following controls:
99
101
100
102
| Control | Type | Description |
101
- | --------- | ------ | ------------------------------------------------ |
103
+ | ------- | ---- | ---------------------------------------------- |
102
104
| pressed | int | Set to 1 to press the button, 0 to release it. |
103
105
104
106
The following example simulates a button press on "btn1" for 200ms:
105
107
106
108
``` yaml
107
- - set-control :
108
- part-id : btn1
109
- control : pressed
110
- value : 1
111
- - delay : 200ms
112
- - set-control :
113
- part-id : btn1
114
- control : pressed
115
- value : 0
109
+ - set-control :
110
+ part-id : btn1
111
+ control : pressed
112
+ value : 1
113
+ - delay : 200ms
114
+ - set-control :
115
+ part-id : btn1
116
+ control : pressed
117
+ value : 0
116
118
` ` `
117
119
118
120
## Simulator examples
0 commit comments