@@ -21,7 +21,9 @@ One of the standout features of Nodepp is its 100% asynchronous architecture, po
2121- π: Include support for ** Reactive Programming** based on ** Events** and ** Observers** .
2222- π: Include an ** Event Loop** that can handle multiple events and tasks on a single thread.
2323
24- ## Hello world
24+ ## Examples
25+
26+ ### Hello world
2527``` cpp
2628#include < nodepp.h>
2729
@@ -33,9 +35,36 @@ void onMain() {
3335}
3436```
3537
36- ## Events
38+ ### Coroutines
39+ ``` cpp
40+ #include < nodepp.h>
41+
42+ using namespace nodepp ;
43+
44+ void onMain () {
45+
46+ ptr_t<uchar> IO ({ 2, 3, 4, 5 });
47+ for( auto x: IO ){ pinMode( x, OUTPUT ); }
48+
49+ process::add ( coroutine::add ( COROUTINE (){
50+ static uchar pin = 0;
51+ coBegin
52+
53+ while( true ){
54+ digitalWrite ( pin, LOW );
55+ pin = ( pin + 1 ) % IO.size();
56+ digitalWrite( pin, HIGH );
57+ coDelay( 300 ); }
58+
59+ coFinish
60+ }));
61+
62+ }
63+ ```
64+
65+ ### Events
3766``` cpp
38- #include < nodepp/nodepp .h>
67+ #include < nodepp.h>
3968#include < nodepp/event.h>
4069
4170using namespace nodepp ;
@@ -54,40 +83,74 @@ void onMain(){
5483 ev.emit();
5584
5685}
57-
58- // note that we are using onMain() instead of main()
5986```
6087
61- ## Timer
88+ ### Timer
6289``` cpp
63- #include < nodepp/nodepp .h>
90+ #include < nodepp.h>
6491#include < nodepp/timer.h>
6592
6693using namespace nodepp ;
6794
6895void onMain (){
6996
7097 pinMode ( 13, OUTPUT );
71-
72- timer::interval([ =] ( ) {
98+
99+ timer::interval ([ =] ( ) {
73100 static bool b=0; b=!b;
74101 digitalWrite( 13, b );
75102 }, 1000 );
76103
77104}
78105```
79106
107+ ### Promises
108+ ``` cpp
109+ #include < nodepp.h>
110+ #include < nodepp/promise.h>
111+
112+ using namespace nodepp ;
113+
114+ void onMain (){ Serial.begin( 9600 );
115+
116+ promise_t<int,except_t>([=]( res_t<int> res, rej_t<except_t> rej ){
117+ res ( 10 );
118+ })
119+
120+ .then([=]( int res ){ console::log( res ); })
121+
122+ .fail([=]( except_t err ){ console::log( err.what() ); })
123+
124+ }
125+ ```
126+
127+ ### More Examples [ here] ( https://nodeppofficial.github.io/nodepp-doc/guide.html )
128+
129+ ## Learn By Projects
130+ ### 3 channel Asynchronous Led Chaser
131+ [ ![ IMAGE] ( https://thumbs.wokwi.com/projects/397439909199432705/thumbnail.jpg?tile&t=1764261498303 )] ( https://wokwi.com/projects/397439909199432705 )
132+
133+ ### 3 Channel Asynchronous Counter
134+
135+ [ ![ IMAGE] ( https://thumbs.wokwi.com/projects/448348853985471489/thumbnail.jpg?tile&t=1764010799509 )] ( https://wokwi.com/projects/448348853985471489 )
136+
137+ ### Dining Philosophers
80138
81- ### More Examples [ here ] ( https://github. com/NodeppOfficial/Nodepp/tree/main/examples )
139+ [ ![ IMAGE ] ( https://thumbs.wokwi. com/projects/448442428745256961/thumbnail.jpg?tile&t=1764005366748 )] ( https://wokwi.com/projects/448442428745256961 )
82140
83- ## Compatibility
141+ ### Asynchronous measurement
142+
143+ [ ![ IMAGE] ( https://thumbs.wokwi.com/projects/448295308358068225/thumbnail.jpg?tile&t=1763835521676 )] ( https://wokwi.com/projects/448295308358068225 )
144+
145+ ### Event-Driven Button
146+
147+ [ ![ IMAGE] ( https://thumbs.wokwi.com/projects/448281938490194945/thumbnail.jpg?tile&t=1764262506939 )] ( https://wokwi.com/projects/448281938490194945 )
148+
149+ ## Nodepp Supports Other Platforms Too
84150- π: [ NodePP for Window | Linux | Mac | Bsd ] ( https://github.com/NodeppOfficial/nodepp )
85151- π: [ NodePP for Arduino] ( https://github.com/NodeppOfficial/nodepp-arduino )
86152- π: [ Nodepp for WASM] ( https://github.com/NodeppOfficial/nodepp-wasm )
87-
88- ## FAQ
89- - π : [ /r/Nodepp/] ( https://www.reddit.com/r/Nodepp/comments/1eaq1pu/faq_ask_anything_about_nodepp/ )
90-
153+
91154## Contribution
92155
93156If you want to contribute to ** Nodepp** , you are welcome to do so! You can contribute in several ways:
0 commit comments