Skip to content

Set a method of an object as callback for a timer #15

@chess-levin

Description

@chess-levin

Hi Marcello,
I have an object that should be able to call a method triggered by a timer. But nothing happens when I instantiate an object of my class and call run():

class LightShow {

private:

  SimpleTimer timer;

public:

  LightShow(SimpleTimer timer):
    timer(timer),
  {}

  void run() {
    timer.setInterval(3000, show);
  }

  static void show() {
    Serial.println("Triggered");
  }
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions