Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 650 Bytes

README.md

File metadata and controls

31 lines (22 loc) · 650 Bytes

FIFObuffer

Simple FIFO buffer designed for use with an Arduino

Adapted from Arduino-FIFO by Daniel Eisterhold

Changes made:

  • Added extra methods
  • You can change the type and size of the buffer

Explanation

https://en.wikipedia.org/wiki/FIFO_(computing_and_electronics)

FIFO queue image

(image credit Vegpuff/Wikipedia)

Example

#include "FIFObuffer.h"
#include "iostream"

int main(int args, char **argv) {
    FIFObuffer<int, 3> buffer;
    buffer.put(1);
    buffer.put(2);
    buffer.put(3);
    std::cout << buffer.sum() << "\n";  // outputs 6
}