Skip to content

Commit 9f0be38

Browse files
authored
Add array example + update samples (#37)
- add array example - update examples - minor edits
1 parent b53b1ea commit 9f0be38

File tree

24 files changed

+177
-28
lines changed

24 files changed

+177
-28
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

88

9+
## [0.4.8] - 2025-08-01
10+
- add array example
11+
- update examples
12+
- minor edits
13+
914
## [0.4.7] - 2024-08-12
1015
- Fix #33, add **float getCoefficientOfVariation()**
1116
- update readme.md

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2012-2024 Rob Tillaart
3+
Copyright (c) 2012-2025 Rob Tillaart
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,18 @@ update the internal **\_sum**.
3636
- https://github.com/RobTillaart/Correlation
3737
- https://github.com/RobTillaart/GST - Golden standard test metrics
3838
- https://github.com/RobTillaart/Histogram
39+
- https://github.com/RobTillaart/infiniteAverage
3940
- https://github.com/RobTillaart/RunningAngle
4041
- https://github.com/RobTillaart/RunningAverage
4142
- https://github.com/RobTillaart/RunningMedian
4243
- https://github.com/RobTillaart/statHelpers - combinations & permutations
4344
- https://github.com/RobTillaart/Statistic
4445
- https://github.com/RobTillaart/Student
4546

47+
For printing floats in scientific or engineering format
48+
49+
https://github.com/RobTillaart/printHelpers
50+
4651

4752
## Interface
4853

RunningAverage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// FILE: RunningAverage.cpp
33
// AUTHOR: Rob Tillaart
4-
// VERSION: 0.4.7
4+
// VERSION: 0.4.8
55
// DATE: 2011-01-30
66
// PURPOSE: Arduino library to calculate the running average by means of a circular buffer
77
// URL: https://github.com/RobTillaart/RunningAverage

RunningAverage.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// FILE: RunningAverage.h
44
// AUTHOR: Rob Tillaart
5-
// VERSION: 0.4.7
5+
// VERSION: 0.4.8
66
// DATE: 2011-01-30
77
// PURPOSE: Arduino library to calculate the running average by means of a circular buffer
88
// URL: https://github.com/RobTillaart/RunningAverage
@@ -14,7 +14,7 @@
1414
#include "Arduino.h"
1515

1616

17-
#define RUNNINGAVERAGE_LIB_VERSION (F("0.4.7"))
17+
#define RUNNINGAVERAGE_LIB_VERSION (F("0.4.8"))
1818

1919

2020
class RunningAverage

examples/fillValue/fillValue.ino

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,36 @@ int samples = 0;
1515
uint32_t start, stop;
1616

1717

18-
void setup(void)
18+
void setup(void)
1919
{
2020
Serial.begin(115200);
21-
Serial.print("Demo RunningAverage lib - fillValue ");
21+
Serial.println();
22+
Serial.println(__FILE__);
2223
Serial.print("RUNNINGAVERAGE_LIB_VERSION: ");
2324
Serial.println(RUNNINGAVERAGE_LIB_VERSION);
25+
Serial.println();
26+
2427
delay(10);
28+
// explicitly start clean
29+
myRA.clear();
2530

2631
for (int i = 0; i < 15; i++)
2732
{
2833
measure_duration(i);
2934
}
30-
35+
3136
Serial.println();
3237
}
3338

3439

35-
void loop(void)
40+
void loop(void)
3641
{
3742
long rn = random(0, 100);
3843
myRA.addValue(rn / 100.0);
3944
samples++;
4045
Serial.print("Running Average: ");
4146
Serial.println(myRA.getAverage(), 4);
42-
47+
4348
if (samples == 300)
4449
{
4550
samples = 0;

examples/ra_300/ra_300.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ void setup(void)
2020
Serial.println(__FILE__);
2121
Serial.print("RUNNINGAVERAGE_LIB_VERSION: ");
2222
Serial.println(RUNNINGAVERAGE_LIB_VERSION);
23-
23+
Serial.println();
24+
25+
delay(10);
26+
// explicitly start clean
2427
myRA.clear();
28+
2529
for (uint16_t i = 0; i < 1000; i++)
2630
{
2731
myRA.addValue(i);

examples/ra_300_last/ra_300_last.ino

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ void setup(void)
2020
Serial.println(__FILE__);
2121
Serial.print("RUNNINGAVERAGE_LIB_VERSION: ");
2222
Serial.println(RUNNINGAVERAGE_LIB_VERSION);
23+
Serial.println();
2324

25+
delay(10);
26+
// explicitly start clean
2427
myRA.clear();
28+
2529
for (uint16_t i = 0; i < 1000; i++)
2630
{
2731
myRA.addValue(i); // random(1000)); (i);

examples/ra_FastAverageTest/ra_FastAverageTest.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ void setup(void)
2626
Serial.println(__FILE__);
2727
Serial.print("RUNNINGAVERAGE_LIB_VERSION: ");
2828
Serial.println(RUNNINGAVERAGE_LIB_VERSION);
29+
Serial.println();
2930

3031
// explicitly start clean
3132
myRA.clear();
@@ -58,7 +59,7 @@ void measure_duration()
5859
Serial.println(stop - start);
5960
delay(10);
6061
Serial.println();
61-
}
62+
}
6263

6364

6465
void test(long n)

examples/ra_MinMaxBufferTest/ra_MinMaxBufferTest.ino

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ void setup(void)
2020
Serial.println(__FILE__);
2121
Serial.print("RUNNINGAVERAGE_LIB_VERSION: ");
2222
Serial.println(RUNNINGAVERAGE_LIB_VERSION);
23-
myRA.clear(); // explicitly start clean
23+
Serial.println();
24+
25+
delay(10);
26+
// explicitly start clean
27+
myRA.clear();
2428

2529
Serial.println("\nCNT\tMIN\tMINBUF\tMAX\tMAXBUF");
2630
}

0 commit comments

Comments
 (0)