Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
tfeldmann committed Dec 16, 2021
2 parents ab4d47b + f359eca commit 2f808bb
Show file tree
Hide file tree
Showing 17 changed files with 107 additions and 87 deletions.
12 changes: 8 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
# Changelog

## v2.0.1 (2021-12-16)

- Renamed library to `Blinkenlight`

## v2.0.0 (2021-12-16)

- **Revamped API!**
- New: writes the state only on changes, not on every update
- Renamed the classes and header files:
- `IndicatorPin` -> `Indicator`
- `FadingIndicatorPin` -> `FadeIndicator`
- `Indicator` -> `BaseIndicator`
- `FadingIndicator` -> `BaseFadeIndicator`
- `BlinkenlightPin` -> `Blinkenlight`
- `FadingBlinkenlightPin` -> `Fadinglight`
- `Blinkenlight` -> `BaseBlinker`
- `FadingBlinkenlight` -> `BaseFader`
- Code cleanups
- Uses GitHub Actions for tests

Expand Down
52 changes: 34 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
# Arduino-Indicator
# Arduino-Blinkenlight

[![tests](https://github.com/tfeldmann/Arduino-Indicator/actions/workflows/tests.yml/badge.svg)](https://github.com/tfeldmann/Arduino-Indicator/actions/workflows/tests.yml)
[![tests](https://github.com/tfeldmann/Arduino-Blinkenlight/actions/workflows/tests.yml/badge.svg)](https://github.com/tfeldmann/Arduino-Blinkenlight/actions/workflows/tests.yml)

## 🚨 Supercharge your status-LEDs 🚨

> This library gives you non-blocking blinking patterns and smooth fade effects for your
> LEDs, buzzers or any other status indicators
<pre align="center">
<strong>Achtung Alles Lookenskeepers!</strong>
Das computermachine ist nicht fuer gefingerpoken und
mittengrabben. Ist easy schnappen der springenwerk,
blowenfusen und poppencorken mit spitzensparken. Ist nicht
fuer gewerken bei das dumpkopfen. Das rubbernecken
sichtseeren keepen das cotten-pickenen hans in das pockets
muss; <i>relaxen und watchen das blinkenlichten.</i>
</pre>

## Why

I created this library because I like to blink my error codes to the user. So for
example blink two times for problems with component X, three times for component Y - you
get the idea.

## Features

- Basics: On / off / toggle
Expand All @@ -31,9 +47,9 @@ This example blinks the built-in LED on pin 13 in the following pattern:
- Repeat

```C
#include <FadeIndicator.h>
#include <Fadinglight.h>

FadeIndicator led(13);
Fadinglight led(13);

void setup()
{
Expand All @@ -49,19 +65,19 @@ void loop()
Easy, uh? It's not only blinking, it does so with smooth fading effects and
logarithmic LED brightness compensation. Your boards never looked more professional! /s
> Note: If you don't love the fading effects, just use the `Indicator`-class instead of
> `FadeIndicator`.
> Note: If you don't love the fading effects, just use the `Blinkenlight`-class instead
> of `Fadinglight`. This sure does make your code more stylish.
## Full API
```C
// Without fading effect:
#include <Indicator.h>
Indicator myPin(13);
#include <Blinkenlight.h>
Blinkenlight myPin(13);
// With fading effect:
#include <FadeIndicator.h>
FadeIndicator myPin(13);
#include <Fadinglight.h>
Fadinglight myPin(13);
// now in your code you can do:
myPin.permanent(LOW);
Expand Down Expand Up @@ -126,24 +142,24 @@ void setSpeed(uint16_t on_ms);
myLed.settings.on_ms = 250;
myLed.settings.pause_ms = 2000;

// `true` if the indicator is currently blinking, showing a pattern, flashing or pausing
// `true` if the Blinkenlight is currently blinking, showing a pattern, flashing or pausing
bool isOn();

// You must call this in your loop!
// Returns the current value of the indiciator (LOW / HIGH).
// Returns the current value of the light (LOW / HIGH).
// - You can ignore that if you want.
int update();
```
## My status indicator is controlled via CAN / I2C / SPI / ... What can I do?
## I have a status indicator controlled via CAN / I2C / SPI / ... What can I do?
No problem! You have two options.
- Use the generic `BaseIndicator` class from `<BaseIndicator.h>`. The `.update()`-method
- Use the generic `BaseBlinker` class from `<BaseBlinker.h>`. The `.update()`-method
returns a boolean whether the status is currently `HIGH` or `LOW`. You can then send
this value to your status indicator (see `examples/GenericBlink`).
Use the `BaseFadeIndictor` class if you want fading effects. Here the `update` method
this value to your status Blinkenlight (see `examples/GenericBlink`).
Use the `BaseFader` class if you want fading effects. Here the `update` method
returns an integer `0..255`.
- Subclass the `BaseIndicator` class with custom logic. This is what `Indicator` does
internally (see `src/Indicator.h`). Have a look at the `SerialBlink` example!
- Subclass the `BaseBlinker` class with custom logic. This is what `Blinkenlight` does
internally (see `src/Blinkenlight.h`). Have a look at the `SerialBlink` example!
6 changes: 3 additions & 3 deletions examples/Blink/Blink.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
Start a blinking pattern on the built-in LED with a smooth fading effect.
*/

#include <FadeIndicator.h>
#include <Fadinglight.h>

// We use `FadeIndicator` for a smooth fade.
FadeIndicator led(13);
// We use `Fadinglight` for a smooth fade.
Fadinglight led(13);

void setup()
{
Expand Down
4 changes: 2 additions & 2 deletions examples/CustomSpeed/CustomSpeed.ino
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <Indicator.h>
#include <Blinkenlight.h>

Indicator led(13);
Blinkenlight led(13);
SpeedSetting mySettings = {
.on_ms = 100,
.off_ms = 100,
Expand Down
4 changes: 2 additions & 2 deletions examples/FadingBlink/FadingBlink.ino
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
Start a blinking pattern on the built-in LED with a smooth fading effect.
*/
#include <FadeIndicator.h>
#include <Fadinglight.h>

FadeIndicator led(13);
Fadinglight led(13);

void setup()
{
Expand Down
12 changes: 6 additions & 6 deletions examples/GenericBlink/GenericBlink.ino
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
/*
This example shows how to use a generic indicator.
This example shows how to use a generic Blinkenlight.
The `update()` method returns HIGH or LOW that you can use however you want.
Of course this example would be easer with a `Indicator` which handles the
Of course this example would be easer with a `Blinkenlight` which handles the
digital output automatically.
*/
#include <BaseIndicator.h>
#include <BaseBlinker.h>

BaseIndicator myIndicator;
BaseBlinker myBlinkenlight;

void setup()
{
pinMode(13, OUTPUT);
myIndicator.blink();
myBlinkenlight.blink();
}

void loop()
{
bool isOn = myIndicator.update();
bool isOn = myBlinkenlight.update();
digitalWrite(13, isOn);
}
4 changes: 2 additions & 2 deletions examples/Pattern/Pattern.ino
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <Indicator.h>
#include <Blinkenlight.h>

Indicator led(13);
Blinkenlight led(13);

void setup()
{
Expand Down
4 changes: 2 additions & 2 deletions examples/Pattern2/Pattern2.ino
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <Indicator.h>
#include <Blinkenlight.h>

Indicator led(13);
Blinkenlight led(13);

void setup()
{
Expand Down
4 changes: 2 additions & 2 deletions examples/SerialBlink/SerialBlink.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* port.
*/

#include <BaseIndicator.h>
#include <BaseBlinker.h>

class SerialBlinker : public BaseIndicator
class SerialBlinker : public BaseBlinker
{
public:
void write(int state) override
Expand Down
4 changes: 2 additions & 2 deletions examples/SpeedAdjustment/SpeedAdjustment.ino
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <FadeIndicator.h>
#include <Fadinglight.h>

FadeIndicator led(13);
Fadinglight led(13);

uint32_t lastSwitch;
bool isFast;
Expand Down
8 changes: 4 additions & 4 deletions library.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "Indicator",
"version": "2.0.0",
"name": "Blinkenlight",
"version": "2.0.1",
"description": "This library gives you non-blocking blinking patterns and smooth fade effects for your LEDs, buzzers or any other status indicators",
"keywords": "led, signal, fading, blink",
"repository": {
"type": "git",
"url": "https://github.com/tfeldmann/Arduino-Indicator.git"
"url": "https://github.com/tfeldmann/Arduino-Blinkenlight.git"
},
"authors": [
{
Expand All @@ -16,7 +16,7 @@
}
],
"license": "MIT",
"homepage": "https://github.com/tfeldmann/Arduino-Indicator",
"homepage": "https://github.com/tfeldmann/Arduino-Blinkenlight",
"dependencies": [],
"frameworks": "arduino",
"platforms": "*",
Expand Down
6 changes: 3 additions & 3 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=Indicator
version=2.0.0
name=Blinkenlight
version=2.0.1
author=Thomas Feldmann <[email protected]>
maintainer=Thomas Feldmann <[email protected]>
sentence=Supercharge your status LEDs / beepers
paragraph=This library gives you non-blocking blinking patterns and smooth fade effects for your LEDs, buzzers or any other status indicators
category=Signal Input/Output
url=https://github.com/tfeldmann/Arduino-Indicator
url=https://github.com/tfeldmann/Arduino-Blinkenlight
architectures=*
Loading

0 comments on commit 2f808bb

Please sign in to comment.