Coder Social home page Coder Social logo

arduino-buffer's Introduction

Arduino Buffer

This is a arduino library that helps to buffer values.

Instalation

  1. Download the master branch from github.
  2. Unzip the file on the arduino library folder
  3. Restart the Arduino IDE

Features

  • Get buffer averages

Getting Started

Create buffer instance

Buffer b = Buffer(length, init);

or

Buffer b(length, init);

or

Buffer* b = new Buffer(length, init);

Constructor

Buffer(length, init) Create a new instance and clear the buffer. length: Buffer size, init: Initial value

Getters

  • calcAverage() Calc the buffer average and return the result
  • getAverage() Just return the buffer average
  • getAt(index) Returns the buffer value by index
  • empty() Check if the buffer average is equals the initial value

Setters

  • fill(value) Fill the buffer with the value
  • insert(value) Insert a new value to the buffer and calls calcAverage()
  • clear() Fill the buffer with the initial value

Example

// Create a instance of Buffer
Buffer sensorBuffer(10, 0);

// Your sensor read function
void sensorRead(){
	// Get a new sensor value
	int read = readSensor();
	
	// Insert the new value on buffer
	sensorBuffer.insert(read);
	
	// Print the sensor average on Serial Monitor
	Serial.println(sensorBuffer.getAverage());
}

arduino-buffer's People

Contributors

daviinacio avatar

Stargazers

 avatar

Watchers

 avatar  avatar

arduino-buffer's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.