2017-12-09 21:43:57 +01:00
|
|
|
//
|
|
|
|
// FILE: printCharArray4.ino
|
|
|
|
// AUTHOR: Rob Tillaart
|
|
|
|
// PURPOSE: demo it takes less time to send data out.
|
2020-11-27 11:28:57 +01:00
|
|
|
// URL: https://github.com/RobTillaart/PrintCharArray
|
2021-11-13 16:35:33 +01:00
|
|
|
|
2017-12-09 21:43:57 +01:00
|
|
|
|
|
|
|
#include "PrintCharArray.h"
|
|
|
|
|
2020-11-27 11:28:57 +01:00
|
|
|
PrintCharArray ps(200);
|
2017-12-09 21:43:57 +01:00
|
|
|
|
|
|
|
uint32_t start, stop;
|
|
|
|
|
2021-11-13 16:35:33 +01:00
|
|
|
|
2017-12-09 21:43:57 +01:00
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
Serial.begin(115200);
|
|
|
|
Serial.println(__FILE__);
|
|
|
|
|
|
|
|
Serial.println("Using direct print");
|
2020-11-27 11:28:57 +01:00
|
|
|
start = micros();
|
|
|
|
for (int i = 0; i < 10; i++)
|
2017-12-09 21:43:57 +01:00
|
|
|
{
|
2020-11-27 11:28:57 +01:00
|
|
|
Serial.println(1000 + i);
|
2017-12-09 21:43:57 +01:00
|
|
|
}
|
2020-11-27 11:28:57 +01:00
|
|
|
stop = micros();
|
2017-12-09 21:43:57 +01:00
|
|
|
Serial.println(stop - start);
|
|
|
|
Serial.println();
|
|
|
|
|
|
|
|
Serial.println("Using printCharArray");
|
2020-11-27 11:28:57 +01:00
|
|
|
start = micros();
|
2017-12-09 21:43:57 +01:00
|
|
|
ps.clear();
|
2020-11-27 11:28:57 +01:00
|
|
|
for (int i = 0; i < 10; i++)
|
2017-12-09 21:43:57 +01:00
|
|
|
{
|
2020-11-27 11:28:57 +01:00
|
|
|
ps.println(1000 + i);
|
2017-12-09 21:43:57 +01:00
|
|
|
}
|
|
|
|
Serial.println(ps.getBuffer());
|
2020-11-27 11:28:57 +01:00
|
|
|
stop = micros();
|
2017-12-09 21:43:57 +01:00
|
|
|
Serial.println(stop - start);
|
|
|
|
Serial.println();
|
|
|
|
|
2020-11-27 11:28:57 +01:00
|
|
|
Serial.println("print PrintCharArray again");
|
|
|
|
start = micros();
|
2017-12-09 21:43:57 +01:00
|
|
|
Serial.println(ps.getBuffer());
|
2020-11-27 11:28:57 +01:00
|
|
|
stop = micros();
|
|
|
|
Serial.println(stop - start);
|
|
|
|
Serial.println();
|
2017-12-09 21:43:57 +01:00
|
|
|
|
2020-11-27 11:28:57 +01:00
|
|
|
Serial.print("FREE: ");
|
2021-01-29 12:31:58 +01:00
|
|
|
Serial.println(ps.available());
|
2017-12-09 21:43:57 +01:00
|
|
|
}
|
|
|
|
|
2021-11-13 16:35:33 +01:00
|
|
|
|
2017-12-09 21:43:57 +01:00
|
|
|
void loop()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2021-11-13 16:35:33 +01:00
|
|
|
|
2020-11-27 11:28:57 +01:00
|
|
|
// -- END OF FILE --
|
2021-11-13 16:35:33 +01:00
|
|
|
|