@@ -10,7 +10,7 @@ sidebar_label: wokwi-pushbutton
1010## Pin names
1111
1212| Name | Description |
13- | ----------- | ------------------------------- |
13+ | --------- | ----------------------------- |
1414| 1.l / 1.r | First contact (left / right) |
1515| 2.l / 2.r | Second contact (left / right) |
1616
@@ -32,8 +32,9 @@ that pin as `INPUT_PULLUP`, and the other contact (e.g. `2.r` or `2.l`) to the g
3232## Attributes
3333
3434| Name | Description | Default value |
35- | -------- | ------------------------------------ | --------------- |
35+ | ------ | ---------------------------------- | ------------- |
3636| color | The color of the push button | "red" |
37+ | xray | Show internal wiring: "1" or "" | "" |
3738| label | Text that appears below the button | "" |
3839| key | Keyboard shortcut for button | |
3940| bounce | Set to "0" to disable bouncing | "" |
@@ -88,31 +89,32 @@ This is useful when you need multiple buttons pressed at the same time.
8889### Examples
8990
9091| Result | Attrs |
91- | --------------------------------------- | --------------------------- |
92+ | ------------------------------------- | ------------------------- |
9293| <wokwi-pushbutton color =" green " /> | ` { "color": "green" } ` |
9394| <wokwi-pushbutton color =" #FFFF00 " /> | ` { "color": "#FFFF00" } ` |
9495| <wokwi-pushbutton label =" Push me! " /> | ` { "label": "Push me!" } ` |
96+ | <wokwi-pushbutton xray =" 1 " /> | ` { "xray": "1" } ` |
9597
9698## Automation controls
9799
98100The pushbutton can be controlled using [ Automation Scenarios] ( ../wokwi-ci/automation-scenarios ) . It exposes the following controls:
99101
100102| Control | Type | Description |
101- | --------- | ------ | ------------------------------------------------ |
103+ | ------- | ---- | ---------------------------------------------- |
102104| pressed | int | Set to 1 to press the button, 0 to release it. |
103105
104106The following example simulates a button press on "btn1" for 200ms:
105107
106108``` 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
116118` ` `
117119
118120## Simulator examples
0 commit comments