This library contains Arduino utilities which are too small to be in separate libraries, but are used in multiple projects or other libraries. To avoid duplication, I have collected them into this library.
The following utilities are provided. Click through the hyperlink to see the
documentation for each utility in their respective README.md file:
- PrintStr
#include <PrintStr.h>use namespace print_str;- Provides 2 classes with an in-memory buffer that implement the
Printinterface so that quantities can be printed into it. The string can then be extracted as a normal c-string (const char*).PrintStr<SIZE>: Templatized class with a buffer ofSIZEbytes on the stack.SIZEmust be known at compile-time.PrintStrN(uint16_t size): A normal class which creates a buffer ofsizeon the heap, which is immediately reclaimed when the object is no longer used. Thesizecan be either run-time or compile time values.
- Both of these are meant to be an alternative to the Arduino
Stringclass to avoid or reduce heap fragmentation.
- UrlEncoding
#include <UrlEncoding.h>use namespace url_encoding;- Encodes and decodes strings using "form URL encoding" which converts
spaces
' 'into'+', and non-alphnumerics into percent-hex digits.
- TimingStats
#include <TimingStats.h>use namespace timing_stats;- Helper class to collect data (often durations in milliseconds) and then print out various statistics such as min, max, average, and count.
- PrintUtils
#include <PrintUtils.h>use namespace print_utils;- Useful utilities on
Printobjects such asSerial. IncludesprintfTo(),printPad2To()toprintPad5To()functions.
Version: 0.2 (2020-09-14)
Changelog: CHANGELOG.md
The latest stable release will be available in the Arduino IDE Library Manager soon. Search for "AceUtils". Click Install. (Not yet).
The development version can be installed by cloning the
GitHub repository, checking out the
develop branch, then manually copying over the contents to the ./libraries
directory used by the Arduino IDE. (The result is a directory named
./libraries/AceUtils.) The master branch contains the stable release.
src/AceUtil.h: A bookkeeping header file that includes the version and Doxygen docs. Individual utilities have their own header files.src/*.h: Header file for each utility listed above.examples/*: Example code for various utilities.tests/*: Unit tests using AUnit.
The docs/ directory contains the Doxygen docs on GitHub Pages. This may be useful to navigate the various classes in this library and to lookup the signatures of the methods in those classes.
See the README.md for each of the various utilties listed above.
This library was developed and tested using:
- Arduino IDE 1.8.13
- Arduino AVR Boards 1.6.23
- Arduino SAMD Boards 1.8.3
- SparkFun AVR Boards 1.1.12
- SparkFun SAMD Boards 1.6.2
- ESP8266 Arduino 2.7.4
- ESP32 Arduino 1.0.2
- Teensydino 1.46
It should work with PlatformIO but I have not tested it.
Many utilities work on Linux or MacOS (using both g++ and clang++ compilers) using the UnixHostDuino emulation layer.
I use Ubuntu 18.04 and 20.04 for the vast majority of my development. I expect that the library will work fine under MacOS and Windows, but I have not tested them.
Most utilities will work on various Arduino boards. I test most utilities on on the following boards:
- Arduino Nano clone (16 MHz ATmega328P)
- SparkFun Pro Micro clone (16 MHz ATmega32U4)
- WeMos D1 Mini clone (ESP-12E module, 80 MHz ESP8266)
- ESP32 dev board (ESP-WROOM-32 module, 240 MHz dual core Tensilica LX6)
Some utlities work only on microcontrollers with built-in WiFi. The header
files for those utilities will contain preprpocessor directives using #ifdef
to print out a warning if the board is not one of the following:
- ESP8266
- ESP32
I will occasionally test on the following hardware as a sanity check:
- Teensy 3.2 (72 MHz ARM Cortex-M4)
- Mini Mega 2560 (Arduino Mega 2560 compatible, 16 MHz ATmega2560)
- SAMD21 M0 Mini (48 MHz ARM Cortex-M0+) (compatible with Arduino Zero)
If you have any questions, comments, bug reports, or feature requests, please file a GitHub ticket instead of emailing me unless the content is sensitive. (The problem with email is that I cannot reference the email conversation when other people ask similar questions later.) I'd love to hear about how this software and its documentation can be improved. I can't promise that I will incorporate everything, but I will give your ideas serious consideration.
- Created by Brian T. Park ([email protected]).