SBK_BarDrive Library 2.2.0
LED bar meter control and queued animations for Arduino
Loading...
Searching...
No Matches
genericMatrixDemo.ino
Go to the documentation of this file.
1/**
2 * @file genericMatrixDemo.ino
3 * @brief Demonstrates a generic rows-by-columns matrix bar meter.
4 * @version 2.2.0
5 * @license MIT
6 */
7
8#include <Arduino.h>
9
10#define SBK_BARDRIVE_WITH_ANIM
11
12#include <SBK_MAX72xxSoft.h>
13#include <SBK_BarDrive.h>
14
15constexpr uint8_t DIN_PIN = A4;
16constexpr uint8_t CLK_PIN = A5;
17constexpr uint8_t CS_PIN = A3;
18
19SBK_MAX72xxSoft driver(DIN_PIN, CLK_PIN, CS_PIN, 1);
20SBK_BarDrive<SBK_MAX72xxSoft> bar(
21 &driver, 0, 4, 7, BarDirection::FORWARD);
22
23void setup()
24{
25 Serial.begin(115200);
26 driver.begin();
27
28 // A generic 4 x 7 matrix contains 28 logical segments.
29 Serial.print(F("Generic matrix segments: "));
30 Serial.println(bar.getSegsNum());
31
32 bar.animations().animInit().bounceFillUpIntv(25).loop();
33}
34
35void loop()
36{
37 bar.animations().update();
38 bar.show();
39}