sstaub / ticktwo Goto Github PK
View Code? Open in Web Editor NEWTicker library for ESP and mbed based Arduino boards
License: MIT License
Ticker library for ESP and mbed based Arduino boards
License: MIT License
Hi
There appears to be an order of operation?
So I want to start the ticker when a function has been called. All of the examples have the ticker start in setup.
I have tried to move the start to the function but it doesn't appear to work.
If you call .update() before calling start the call back is never called. Is there a fix for this?
Example:
#include "TickTwo.h"
TickTwo timer4(blink, 500);
void setup()
{
}
void loop
{
timer4.update();
int input = 1;
if (input == 1)
{
doSomeAction();
}
}
void doSomeAction()
{
timer4.start();
}
void blink()
{
digitalWrite(LED_BUILTIN, ledState);
ledState = !ledState;
}
It is easy for you to say no delays! I can control my own sources and use asynchronous solutions, but most hardware drivers and NTP packages contain delays, and it is too large a task for one person to rewrite them all. And a large number of tickers would it be when replacing all delays in the used libraries! What to do when there is no way to avoid delays in included hierarchies of packages? Even the most used I2C drivers are not asynchronous, but use delays.
Hi there, I'm trying to use this on M5Stack Core2 (ESP32). I'm using platformio. I don't think this library is registered in the arduino libraries, so I downloaded the zip, renamed folder to "TickTwo" and moved the folder to the platformio "inlcude" folder. It compiles ok however fails on linking:
Linking .pio/build/M5Unified/firmware.elf
.pio/build/M5Unified/src/main.cpp.o:(.literal._Z5setupv+0x30): undefined reference to `TickTwo::start()'
.pio/build/M5Unified/src/main.cpp.o:(.literal._Z4loopv+0x6c): undefined reference to `TickTwo::update()'
.pio/build/M5Unified/src/main.cpp.o:(.literal.startup._GLOBAL__sub_I_leds+0x10): undefined reference to `TickTwo::TickTwo(std::function<void ()>, unsigned int, unsigned int, resolution_t)'
.pio/build/M5Unified/src/main.cpp.o:(.literal.exit._GLOBAL__sub_D_leds+0x0): undefined reference to `TickTwo::~TickTwo()'
.pio/build/M5Unified/src/main.cpp.o: In function `setup()':
/Users/patrickfelstead/Documents/PlatformIO/Projects/M5Stack Core2 CO2 Monitor/.pio/libdeps/M5Unified/M5GFX/src/lgfx/v1/misc/colortype.hpp:585: undefined reference to `TickTwo::start()'
.pio/build/M5Unified/src/main.cpp.o: In function `loop()':
/Users/patrickfelstead/Documents/PlatformIO/Projects/M5Stack Core2 CO2 Monitor/.pio/libdeps/M5Unified/M5GFX/src/lgfx/v1/misc/colortype.hpp:585: undefined reference to `TickTwo::update()'
.pio/build/M5Unified/src/main.cpp.o: In function `_GLOBAL__sub_I_leds':
/Users/patrickfelstead/Documents/PlatformIO/Projects/M5Stack Core2 CO2 Monitor/.pio/libdeps/M5Unified/M5GFX/src/lgfx/v1/misc/colortype.hpp:585: undefined reference to `TickTwo::TickTwo(std::function<void ()>, unsigned int, unsigned int, resolution_t)'
.pio/build/M5Unified/src/main.cpp.o: In function `_GLOBAL__sub_D_leds':
/Users/patrickfelstead/Documents/PlatformIO/Projects/M5Stack Core2 CO2 Monitor/.pio/libdeps/M5Unified/M5GFX/src/lgfx/v1/misc/colortype.hpp:585: undefined reference to `TickTwo::~TickTwo()'
collect2: error: ld returned 1 exit status
*** [.pio/build/M5Unified/firmware.elf] Error 1
=========================================================================== [FAILED] Took 7.03 seconds ===========================================================================
Environment Status Duration
------------- -------- ------------
M5Unified FAILED 00:00:07.028
====================================================================== 1 failed, 0 succeeded in 00:00:07.028 ======================================================================
The terminal process "platformio 'run', '--environment', 'M5Unified'" terminated with exit code: 1.
Terminal will be reused by tasks, press any key to close it.
I'm probably doing something wrong, but not sure what. Do you have any suggestions please?
I can provide my code, but it uses the same format as your example.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.