GY-63_MS5611/libraries/Set/examples/iterationTest/iterationTest.ino

63 lines
967 B
Arduino
Raw Normal View History

2020-11-27 05:33:55 -05:00
//
// FILE: iterationTest.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo first, next, last, prev
// DATE: 2014-11-09
2021-01-29 06:31:58 -05:00
// URL: https://github.com/RobTillaart/SET
2020-11-27 05:33:55 -05:00
#include "set.h"
2021-01-29 06:31:58 -05:00
2020-11-27 05:33:55 -05:00
Set myset;
Set setA, setB;
volatile bool b;
2021-12-28 04:38:33 -05:00
2020-11-27 05:33:55 -05:00
void setup()
{
Serial.begin(115200);
Serial.print("Start set_demo : ");
Serial.println(SET_LIB_VERSION);
Serial.println();
Serial.println("\n\niterate over set test");
randomSeed(1);
2021-01-29 06:31:58 -05:00
setA.clear();
2020-11-27 05:33:55 -05:00
for (int i=0; i<10; i++)
{
2021-01-29 06:31:58 -05:00
setA.add(random(256));
2020-11-27 05:33:55 -05:00
}
Serial.println(setA.count());
int n = setA.first();
while (n != -1)
{
2021-01-29 06:31:58 -05:00
Serial.print(n);
Serial.print('\t');
n = setA.next();
2020-11-27 05:33:55 -05:00
}
Serial.println();
n = setA.last();
while (n != -1)
{
2021-01-29 06:31:58 -05:00
Serial.print(n);
Serial.print('\t');
n = setA.prev();
2020-11-27 05:33:55 -05:00
}
Serial.println();
2021-01-29 06:31:58 -05:00
Serial.println("\ndone...");
2020-11-27 05:33:55 -05:00
Serial.println();
}
2021-12-28 04:38:33 -05:00
2020-11-27 05:33:55 -05:00
void loop()
{
}
2021-12-28 04:38:33 -05:00
// -- END OF FILE --