-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add function to return pointer to readings array.
- Loading branch information
1 parent
858ab21
commit bde0db6
Showing
5 changed files
with
59 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Arduino Moving Average Library | ||
// https://github.com/JChristensen/movingAvg | ||
// Copyright (C) 2020 by Jack Christensen and licensed under | ||
// GNU GPL v3.0, https://www.gnu.org/licenses/gpl.html | ||
// | ||
// Example sketch to demonstrate retrieving the readings | ||
// from a movingAvg object. | ||
|
||
#include <movingAvg.h> // https://github.com/JChristensen/movingAvg | ||
|
||
movingAvg foo(6); | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
foo.begin(); | ||
foo.reading(1); // generate some sample data | ||
foo.reading(2); | ||
foo.reading(3); | ||
foo.reading(4); | ||
//foo.reading(5); | ||
//foo.reading(6); | ||
|
||
int *readings = foo.getReadings(); // returns a pointer to the readings | ||
int n = foo.getCount(); // returns the number of readings | ||
Serial.print("There are "); | ||
Serial.print(n); | ||
Serial.println(" readings:"); | ||
for (int i=0; i<n; i++) { | ||
Serial.println(*readings++); | ||
} | ||
} | ||
|
||
void loop() | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ reading KEYWORD2 | |
getAvg KEYWORD2 | ||
getCount KEYWORD2 | ||
reset KEYWORD2 | ||
getReadings KEYWORD2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name=movingAvg | ||
version=2.1.1 | ||
version=2.2.0 | ||
author=Jack Christensen <[email protected]> | ||
maintainer=Jack Christensen <[email protected]> | ||
sentence=A simple Arduino library for calculating moving averages. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters