This is an ensemble of independent Arduino libraries to manage basic components such as buttons, potentiometers and leds.
Code and functionalities are intentionally trivial and independent to favor fast prototyping, modifications and customization.
Pros:
- modular - completely written in C++ with OOP programming principles and it doesn't interfere with other libraries
- non-blocking - delay() function is not used
- easy to customize
Simply copy the folder of the library you are interested in and import it with #include <NAME_OF_THE_LIBRARY.h>
.
Example usage of the button component with this library.
#include "Arduino.h"
#include <Button.h>
Button button;
void setup()
{
// initialize LED digital pin as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
button.getEvent();
if (button.getToggle())
digitalWrite(LED_BUILTIN, HIGH);
else
digitalWrite(LED_BUILTIN, LOW);
delay(100);
}
Example usage of the potentiometer component with this library.
#include "Arduino.h"
#include <Potentiometer.h>
Potentiometer potentiometer;
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.println(potentiometer.getValue());
Serial.println(potentiometer.getMappedValue(0, 5));
Serial.println(potentiometer.getDoubleMappedValue(0, 5));
delay(200);
}
Example usage of the led component with this library.
#include "Arduino.h"
#include <Led.h>
Led led(2);
void setup() {
}
void loop() {
led.blinkState(1000, 500);
}
by Flavio Primo