Skip to content

Commit 6e7a3a4

Browse files
authored
Update README.md
1 parent 7f06f8a commit 6e7a3a4

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,32 @@ I use long press functionality alot in my codes, so I wanted to add suitable fun
3838
### Why this library was made
3939
Idea was to make fast button library when nothing is pressed so it would affect to the cycle time as little as possible.
4040

41-
Doesn't matter if you have 1 or 18 buttons, update() takes between 3100-3250 microseconds per 1000 update on unpressed buttons -> 3us per loop.
41+
Doesn't matter if you have 1 or 18 buttons, update() takes between 3100-3250 microseconds per 1000 update on unpressed buttons -> 3us per loop
42+
43+
**Measuring time is useless in itself, because just storing micros into uint8_t/uint16_t/uint32_t will affect time differently, but for mere comparison versus other libraries I used:**
44+
```
45+
#include <Bugtton.h>
46+
47+
const uint8_t buttonCount = 5;
48+
const uint8_t buttonPins[buttonCount] = {2,3,4,5,6};
49+
Bugtton buttons(buttonCount, buttonPins, INPUT_PULLUP, 25);
50+
51+
uint32_t t1,t2;
52+
uint16_t count1 = 0;
53+
uint16_t amount = 1000;
54+
55+
void setup() {
56+
Serial.begin(57600);
57+
t1 = micros();
58+
}
59+
60+
void loop() {
61+
buttons.update();
62+
count1++;
63+
if (count1 == amount){
64+
t2 = micros();
65+
Serial.println(t2-t1);
66+
for(;;);
67+
}
68+
}
69+
```

0 commit comments

Comments
 (0)