Skip to content

Commit

Permalink
setup() function added, re-formatting using common .clang-format.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathertel committed Aug 1, 2024
1 parent 93ca0ae commit 70c4b58
Show file tree
Hide file tree
Showing 3 changed files with 245 additions and 243 deletions.
8 changes: 4 additions & 4 deletions examples/SimpleOneButton/SimpleOneButton.ino
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

// Setup a new OneButton on pin PIN_INPUT
// The 2. parameter activeLOW is true, because external wiring sets the button to LOW when pressed.
OneButton *button;
OneButton button;

// In case the momentary button puts the input to HIGH when pressed:
// The 2. parameter activeLOW is false when the external wiring sets the button to HIGH when pressed.
Expand All @@ -67,18 +67,18 @@ void setup()
digitalWrite(PIN_LED, ledState);

// setup OneButton
button = new OneButton(PIN_INPUT, true);
button.setup(PIN_INPUT, INPUT_PULLUP, true);

// link the doubleclick function to be called on a doubleclick event.
button->attachDoubleClick(doubleClick);
button.attachDoubleClick(doubleClick);
} // setup


// main code here, to run repeatedly:
void loop()
{
// keep watching the push button:
button->tick();
button.tick();

// You can implement other code in here or just wait a while
delay(10);
Expand Down
Loading

0 comments on commit 70c4b58

Please sign in to comment.