Skip to content

NodeppOfficial/nodepp-arduino

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nodepp-Arduino: The Unified Asynchronous Real-Time C++ Runtime

The DOOM of Async Frameworks: Write Once, Compile Everywhere, Process Everything.

Platform MIT License

Nodepp-Arduino is a lightweight, 100% asynchronous framework designed to bring the power of event-driven programming to microcontrollers. It eliminates the limitations of blocking code (like delay()), allowing your Arduino to handle massive concurrency—from sensor polling to complex encryption—without skipping a beat.

By combining an internal Event Loop with EE-optimized memory primitives, Nodepp enables a Write Once, Compile Everywhere workflow. Your logic stays consistent whether you're targeting an 8-bit Nano, a dual-core ESP32, or a high-end cloud server.

Featured Project: Asynchronous Enigma Machine

To showcase Nodepp for Arduino efficiency on bare metal hardware, we implemented a fully functional Enigma Machine on an Arduino Nano.

ezgif-7f4dec232396a556.mp4

Try it now: Enigma Machine Simulation

Features

  • Zero-Blocking Architecture: Never use delay() again. Every task runs asynchronously, keeping your MCU responsive.

  • EE-Optimized Memory: Custom ptr_t and string_t use Small Stack Optimization (SSO) and zero-copy slicing to prevent heap fragmentation on low-RAM chips.

  • Universal Logic: Write your application logic once and deploy it across Linux, Windows, Mac, Android, WASM, and ESP32/Arduino.

  • Batteries Included: Built-in engines for JSON parsing, RegExp, UTF manipulation, and Promises—all optimized for embedded constraints.

Code Examples

Coroutines: Multi-threaded Feel on Single-core Chips

Stop managing complex state machines. Use coDelay to pause a task without freezing the whole system.

#include <nodepp.h>

using namespace nodepp;

void onMain() {

    ptr_t<uchar> LEDs ({ 2, 3, 4, 5 }); // SSO Optimized
    for( auto x: LEDs ){ pinMode( x, OUTPUT ); }

    process::add( coroutine::add( COROUTINE(){
        static uchar i = 0;
    coBegin

        while( true ){
            digitalWrite( LEDs[i], LOW );
            i = ( i + 1 ) % LEDs.size();
            digitalWrite( LEDs[i], HIGH );
        coDelay( 300 ); // Non-blocking delay
        }

    coFinish
    }));

}

Event-Driven Logic

Trigger actions based on system signals or custom events seamlessly.

#include <nodepp.h>
#include <nodepp/event.h>

using namespace nodepp;

event_t<> ev;

void onMain(){
    
    pinMode( 13, OUTPUT );

    ev.on([](){
        static bool state=0; state=!state;
        digitalWrite( 13, state );
    });

    ev.emit(); // Manually trigger or bind to interrupts
}

Asynchronous Promises

Handle long-running tasks or sensor readings using a modern Promise style API.

#include <nodepp.h>
#include <nodepp/promise.h>

using namespace nodepp;

void onMain(){ Serial.begin( 9600 );

    promise_t<int,except_t>([=]( res_t<int> res, rej_t<except_t> rej ){
        res( 10 );
    })

    .then([=]( int res ){ console::log( res ); })

    .fail([=]( except_t err ){ console::log( err.what() ); })

}

Explore Projects (Interactive Simulations)

3 channel Asynchronous Led Chaser

IMAGE

LCD 16x2 Async Task

IMAGE

Event-Driven Button

IMAGE

Dining Philosophers

IMAGE

Asynchronous measurement

IMAGE

Asynchronous Traffic Light

IMAGE

3 Channel Asynchronous Counter

IMAGE

Enigma Machine

IMAGE

One Codebase, Every Screen

Nodepp is the only framework that lets you share logic between the deepest embedded layers and the highest web layers.

Contributing

Nodepp is an open-source project that values Mechanical Sympathy and Technical Excellence.

  • Sponsorship: Support the project via Ko-fi.
  • Bug Reports: Open an issue via GitHub.
  • License: MIT.

ko-fi

License

Nodepp is distributed under the MIT License. See the LICENSE file for more details.

Sponsor this project

Packages

No packages published

Contributors 2

  •  
  •