Skip to content

Commit 67905b1

Browse files
committed
Update buttons class, and format a code block
1 parent c5245d7 commit 67905b1

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

docs/readme.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,35 +102,33 @@ Read the state of the pads and save them to be analyze in the different type of
102102
Buttons.update()
103103
```
104104

105-
### ButtonX class
106-
107-
Button0 - Button4
105+
Use TOUCHX being X a number from 0 to 4 (Button00 - Button04)
108106

109107
Get if the pad is getting touched, true until it gets released
110108
```cpp
111-
ButtonX.getTouch()
109+
Buttons.getTouch(TOUCHX)
112110
```
113111

114112
Get when have been a touch down
115113
```cpp
116-
ButtonX.onTouchDown()
114+
Buttons.onTouchDown(TOUCHX)
117115
```
118116

119117
Get when the button has been released
120118
```cpp
121-
ButtonX.onTouchUp()
119+
Buttons.onTouchUp(TOUCHX)
122120
```
123121

124122
Get both, touched and released
125123
```cpp
126-
ButtonX.onTouchChange()
124+
Buttons.onTouchChange(TOUCHX)
127125
```
128126

129127
In case you have another enclosure you can change the sensitivity of the pads, 3-100
130128
Automatically configured when you set the `CARRIER_CASE` boolean, by default is false (sensitivity threshold 4)
131129

132130
```cpp
133-
ButtonX.updateConfig(int newSens)
131+
Buttons.updateConfig(int newSens)
134132
```
135133

136134
#### Syntax example
@@ -148,8 +146,8 @@ void loop(){
148146
carrier.Buttons.update(); // Read the buttons state
149147

150148
//Check if the Button 0 is being touched
151-
if (carrier.Button0.getTouch()){
152-
Serial.println("Touching Button 1");
149+
if (carrier.Buttons.getTouch(TOUCH0)){
150+
Serial.println("Touching Button 0");
153151
}
154152

155153
//You can replace getTouch(), with the other types of touch events
@@ -302,9 +300,12 @@ Colors : every color with the prefix ‘ST77XX_’ i.e. ST77XX_BLACK. Colors ava
302300

303301
In order to turn on the screen you will need to add this inside the setup()
304302
(already inside the main begin())
303+
304+
```cpp
305305
display.init(240, 240);
306306
pinMode(TFT_BLACKLIGHT, OUTPUT);
307307
digitalWrite(TFT_BLACKLIGHT,HIGH);
308+
```
308309
309310
Colors : every color with the prefix ‘ST77XX_’ i.e. ST77XX_BLACK. Colors available from the library are BLACK, WHITE, RED, GREEN, BLUE, CYAN, MAGENTA, YELLOW, ORANGE
310311

0 commit comments

Comments
 (0)