Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By Petervdpol
#36489
Mario Mikočević wrote:Try this ->

Code: Select all#include <Ticker.h>
Ticker tickerSensorScan;
#define WAITTIME 300
boolean tickerFired;

void flagSensorScan( void ) {
  tickerFired = true;
}

void setup() {
  tickerSensorScan.attach( WAITTIME, flagSensorScan );
  tickerFired = true;
}

void loop() {
  if( tickerFired ) {
    tickerFired = false;
    doSomethingWithSensor();
  }
}

Tnx Mario, I have some trouble finding the ticker library, I can see it on Github, but not download... Can you help me there?
User avatar
By Mario Mikočević
#36767
Petervdpol wrote:
Mario Mikočević wrote:Try this ->

Code: Select all#include <Ticker.h>
Ticker tickerSensorScan;
#define WAITTIME 300
boolean tickerFired;

void flagSensorScan( void ) {
  tickerFired = true;
}

void setup() {
  tickerSensorScan.attach( WAITTIME, flagSensorScan );
  tickerFired = true;
}

void loop() {
  if( tickerFired ) {
    tickerFired = false;
    doSomethingWithSensor();
  }
}

Tnx Mario, I have some trouble finding the ticker library, I can see it on Github, but not download... Can you help me there?


Ticker library is included with release so it should just compile.
(https://github.com/esp8266/Arduino/tree ... ies/Ticker)

--
Mozz
User avatar
By Petervdpol
#36774 I am afraid not, see below. Arduino IDE 1.6.6

Arduino: 1.6.6 (Linux), Board: "Arduino Nano, ATmega328"

Code: Select all/tmp/arduino_9a446cbab43419db266fe577368764f4/sketch_dec19a.ino:1:20: fatal error: Ticker.h: No such file or directory
 #include <Ticker.h>
                    ^
compilation terminated.
exit status 1
Error compiling.

  This report would have more information with
  "Show verbose output during compilation"
  enabled in File > Preferences.