Skip to content

Stream Based RingBuffer

Phil Schatzmann edited this page Jun 11, 2025 · 3 revisions

You can write to an Arduino Stream held in PSRAM or HIMEM using RingBufferStreamPSRAM and RingBufferStreamHIMEM:

#include "esp32-psram.h"

void setup() {
  Serial.begin(115200);
  
  // Create a ring buffer in PSRAM with 1024 bytes capacity
  RingBufferStreamPSRAM buffer(1024);
  
  // Write data to the buffer
  buffer.print("Hello, Ring Buffer!");
  
  // Read and print the data
  while (buffer.available()) {
    Serial.write(buffer.read());
  }
}
Clone this wiki locally