You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-12Lines changed: 14 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -154,12 +154,12 @@ void setup() {
154
154
}
155
155
```
156
156
That's all there is to it! If you push this program to your (compatible) microcontroller, it will immediately start printing the following into your Serial console (once per second):
157
-
158
-
>MyFirstThread::OnLoop() - Thread 1 - On CPU 0, Counter = 0
159
-
>MyFirstThread::OnLoop() - Thread 1 - On CPU 0, Counter = 1
160
-
>MyFirstThread::OnLoop() - Thread 1 - On CPU 0, Counter = 2
161
-
>MyFirstThread::OnLoop() - Thread 1 - On CPU 0, Counter = 3
162
-
157
+
```
158
+
MyFirstThread::OnLoop() - Thread 1 - On CPU 0, Counter = 0
159
+
MyFirstThread::OnLoop() - Thread 1 - On CPU 0, Counter = 1
160
+
MyFirstThread::OnLoop() - Thread 1 - On CPU 0, Counter = 2
161
+
MyFirstThread::OnLoop() - Thread 1 - On CPU 0, Counter = 3
162
+
```
163
163
### What about the `loop()` method?
164
164
Your existing `loop()` method will continue to operate exactly as it always has. On the ESP32, the default `loop()` method executes on CPU 1, while you will notice that your instance of `MyFirstThread` (`thread1` in the above sample code) is running on CPU 0.
165
165
@@ -220,12 +220,14 @@ void setup() {
220
220
```
221
221
222
222
We've now added two additional threads, so our output will look something like this:
223
-
>MyFirstThread::OnLoop() - Thread 1 - On CPU 0, Counter = 1
224
-
>MyFirstThread::OnLoop() - Thread 2 - On CPU 1, Counter = 1
225
-
>MyFirstThread::OnLoop() - Thread 3 - On CPU 0, Counter = 1
226
-
>MyFirstThread::OnLoop() - Thread 1 - On CPU 0, Counter = 2
227
-
>MyFirstThread::OnLoop() - Thread 3 - On CPU 0, Counter = 2
228
-
>MyFirstThread::OnLoop() - Thread 2 - On CPU 1, Counter = 2
223
+
```
224
+
MyFirstThread::OnLoop() - Thread 1 - On CPU 0, Counter = 1
225
+
MyFirstThread::OnLoop() - Thread 2 - On CPU 1, Counter = 1
226
+
MyFirstThread::OnLoop() - Thread 3 - On CPU 0, Counter = 1
227
+
MyFirstThread::OnLoop() - Thread 1 - On CPU 0, Counter = 2
228
+
MyFirstThread::OnLoop() - Thread 3 - On CPU 0, Counter = 2
229
+
MyFirstThread::OnLoop() - Thread 2 - On CPU 1, Counter = 2
230
+
```
229
231
230
232
The explicit maximum number of *ESPresio*`Thread`s supported by the library is 256, however the *practical limit* depends entirely on the specifications of your microcontroller. It's almost certainly going to be considerably lower than 256!
0 commit comments