Skip to main content

Core

blokdots.h includes the core module which defines value types, the component lifecycle system, and project state control.

#Value Types

#blokdots::String

A stack-allocated, fixed-capacity string wrapper (64 bytes) that avoids heap fragmentation on Arduino's limited RAM.

C++
blokdots::String s("hello");
blokdots::String n(42);          // "42"
blokdots::String f(3.14f, 2);    // "3.14"
blokdots::String b(true);        // "true"
blokdots::String c(color);       // "RGB(255,128,0)"

protocol.sendData("A0", s.c_str());
ConstructorDescription
String(const char* str)From a C-string
String(int value)Decimal integer
String(float value, uint8_t decimals = 2)Float with fixed decimals
String(bool value)"true" or "false"
String(const Color& color)"RGB(r,g,b)"

Implicitly converts to const char*, so it works directly with Arduino APIs like Serial.print().

#blokdots::Color

C++
struct Color { uint8_t r, g, b; };

A simple RGB color struct. Used by LED strip and signal tower components.

#Component Lifecycle

Components register themselves in their constructor using registerBegin and registerTick. These functions are called automatically when you call beginAll() and tickAll().

C++
void setup() {
  blokdots::beginAll();  // calls begin() on all registered components
}

void loop() {
  blokdots::tickAll();   // calls tick() on all registered components
}
FunctionDescription
blokdots::beginAll()Initialize all registered components (call once in setup())
blokdots::tickAll()Update all registered components (call every loop())
blokdots::registerBegin(fn, ctx)Register a begin callback — called by component constructors
blokdots::registerTick(fn, ctx)Register a tick callback — called by component constructors

#Project State

FunctionDescription
blokdots::start()Resume project execution
blokdots::stop()Pause project execution
blokdots::isRunning()Returns true if the project is running