Comments (2)
Hi @Medel,
Thanks for using the library.
Your code has an issue of not adding ICACHE_RAM_ATTR to the ISR.
Try the following code:
#include <ESP8266WiFi.h>
#include <ESP8266TimerInterrupt.h>
const char ssid[] = "***"; // your network SSID (name)
const char pass[] = "****"; // your network password
ESP8266Timer Timer1;
void ICACHE_RAM_ATTR TimerIrq()
{
}
void setup()
{
Serial.begin(115200); // open the serial port at 38400 bps:
Timer1.attachInterruptInterval(100000, TimerIrq);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, pass);
}
void loop()
{
Serial.print("Millis: ");
Serial.println(millis());
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
Serial.println(WiFi.status());
delay(1000);
}
and the tests are all OK, with WiFi and removing WiFi, repetitively.
Here is the terminal output to show the result running the above code, with timestamp
Millis: 19956
IP address: 192.168.2.136 <= WiFi OK
3
Millis: 20956
IP address: 192.168.2.136
3
Millis: 21956
IP address: 192.168.2.136
3
Millis: 22956
IP address: 192.168.2.136
3
Millis: 23956
IP address: 192.168.2.136
3
Millis: 24956
IP address: 192.168.2.136
3
Millis: 25957
IP address: 192.168.2.136
3
Millis: 26957
IP address: 192.168.2.136
3
Millis: 27957
IP address: (IP unset) <= WiFi removed
6
Millis: 28957
IP address: (IP unset)
6
Millis: 29958
IP address: (IP unset)
6
Millis: 30958
IP address: (IP unset)
6
Millis: 31958
IP address: (IP unset)
6
Millis: 32958
IP address: (IP unset)
6
Millis: 33959
IP address: (IP unset)
6
...
Millis: 96977
IP address: (IP unset)
1
Millis: 97977
IP address: (IP unset)
1
Millis: 98977
IP address: (IP unset)
1
Millis: 99977
IP address: (IP unset)
1
Millis: 100978
IP address: (IP unset)
6
Millis: 101978
IP address: (IP unset)
6
Millis: 102978
IP address: 192.168.2.136 <= WiFi OK again
3
Millis: 103979
IP address: 192.168.2.136
3
Millis: 104979
IP address: 192.168.2.136
3
Millis: 105979
IP address: 192.168.2.136
3
Millis: 106979
IP address: 192.168.2.136
3
Millis: 107980
IP address: 192.168.2.136
3
Millis: 108980
IP address: 192.168.2.136
3
Millis: 109980
IP address: 192.168.2.136
3
Millis: 110981
IP address: 192.168.2.136
3
Millis: 111981
IP address: 192.168.2.136
3
...
Millis: 130991
IP address: 192.168.2.136
3
Millis: 131992
IP address: 192.168.2.136
3
Millis: 132992
IP address: 192.168.2.136
3
Millis: 133992
IP address: 192.168.2.136
3
Millis: 134992
IP address: 192.168.2.136
3
Millis: 135993
IP address: 192.168.2.136
3
Millis: 136993
IP address: 192.168.2.136
3
Millis: 137993
IP address: 192.168.2.136
3
Millis: 138993
IP address: (IP unset) <= WiFi removed
6
Millis: 139994
IP address: (IP unset)
6
Millis: 140994
IP address: (IP unset)
6
Millis: 141994
IP address: (IP unset)
6
Millis: 142994
IP address: (IP unset)
6
Millis: 143995
IP address: (IP unset)
6
Millis: 144995
IP address: (IP unset)
6
Millis: 145995
IP address: (IP unset)
6
...
Millis: 188006
IP address: (IP unset)
1
Millis: 189006
IP address: (IP unset)
1
Millis: 190006
IP address: (IP unset)
1
Millis: 191007
IP address: (IP unset)
6
Millis: 192007
IP address: (IP unset)
6
Millis: 193007
IP address: 192.168.2.136 <= WiFi OK again
3
Millis: 194008
IP address: 192.168.2.136
3
Millis: 195008
IP address: 192.168.2.136
3
Millis: 196008
IP address: 192.168.2.136
3
Millis: 197008
IP address: 192.168.2.136
3
Millis: 198009
IP address: 192.168.2.136
3
Millis: 199009
IP address: 192.168.2.136
3
Millis: 200009
IP address: 192.168.2.136
3
Millis: 201009
IP address: 192.168.2.136
3
Millis: 202010
IP address: 192.168.2.136
3
from esp8266timerinterrupt.
Thank you, it works
from esp8266timerinterrupt.
Related Issues (19)
- Using callback with classes. HOT 1
- Platformio registry lists very old version and is outdated HOT 2
- ESP8266TimerInterrupt listing is outdated HOT 8
- Use std::function for callbacks? HOT 1
- ISR_Timer callback function is not getting called HOT 3
- One shot operating mode HOT 2
- Timer selection
- Question related to multiFileProject example for sharing ISRTimer HOT 5
- Seems to be a problem with times and read/write files to flash HOT 2
- unattach ? HOT 2
- analogWriteRange broke interrupts HOT 3
- Deepsleep functionality HOT 4
- Possible error in RPM_Measure.ino HOT 1
- **The cycle is 1ms, esp8266 is easy to crash** HOT 3
- Why does my variable suddenly resets to 0 HOT 1
- Generating slow PWM HOT 1
- ESP8266Timer and PWM --> wdt reset HOT 5
- Esp8266 Reboot HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esp8266timerinterrupt.