-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(test): ✅ add build tests on github workflows
- Loading branch information
1 parent
5ca50c8
commit 636ecc8
Showing
3 changed files
with
52 additions
and
4 deletions.
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
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,42 @@ | ||
// Include lib: | ||
#include <Arduino.h> | ||
#include <DataTome.h> | ||
|
||
// Create an Arithmetic Moving Average object of unsigned int type, | ||
// 10 in size | ||
DataTomeMvAvg<unsigned, unsigned long> test(10); | ||
DataTomeAnalysis<unsigned, unsigned long> test2(10); | ||
// DataTomeExpAvg<unsigned, unsigned long> test3(10); | ||
|
||
// This variable just generates input for average test | ||
unsigned delta_x = 0; | ||
|
||
void setup() { | ||
// Initialize serial interface | ||
Serial.begin(9600); | ||
} | ||
|
||
void loop() { | ||
// Pushes the input in the moving average object | ||
test.push(delta_x); | ||
|
||
// Generates the next input | ||
delta_x += 5; | ||
if (delta_x > 1000) delta_x = 0; | ||
|
||
// Prints each value stored in the moving average | ||
for (uint8_t i = 0; i < test.size(); i++) { | ||
Serial.print(test[i]); | ||
Serial.print(" "); | ||
} | ||
// Prints the result of the average | ||
Serial.print("= "); | ||
Serial.print(test.get()); | ||
// Prints the value stored in the first and last indexes | ||
Serial.print(" | f: "); | ||
Serial.print(test.front()); | ||
Serial.print(" b: "); | ||
Serial.println(test.back()); | ||
|
||
delay(1000); | ||
} |