2016-03-01 20:10:17 +01:00
|
|
|
/*
|
|
|
|
* Author: Yannick Adam <yannick.adam@gmail.com>
|
|
|
|
* Copyright (c) 2016 Yannick Adam
|
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* This program and the accompanying materials are made available under the
|
|
|
|
* terms of the The MIT License which is available at
|
|
|
|
* https://opensource.org/licenses/MIT.
|
2016-03-01 20:10:17 +01:00
|
|
|
*
|
2019-07-30 19:41:32 -07:00
|
|
|
* SPDX-License-Identifier: MIT
|
2016-03-01 20:10:17 +01:00
|
|
|
*/
|
|
|
|
|
2016-04-28 16:40:18 -07:00
|
|
|
#include "apa102.hpp"
|
2016-03-01 20:10:17 +01:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char** argv)
|
|
|
|
{
|
|
|
|
//! [Interesting]
|
|
|
|
// Instantiate a strip of 30 LEDs on SPI bus 0
|
2017-08-30 15:00:29 -07:00
|
|
|
upm::APA102 ledStrip(800, 0);
|
2016-03-01 20:10:17 +01:00
|
|
|
|
|
|
|
// Set all LEDs to Red
|
2017-08-30 15:00:29 -07:00
|
|
|
ledStrip.setAllLeds(31, 255, 0, 0);
|
2016-03-01 20:10:17 +01:00
|
|
|
|
|
|
|
// Set a section (10 to 20) to blue
|
2017-08-30 15:00:29 -07:00
|
|
|
ledStrip.setLeds(10, 20, 31, 0, 0, 255);
|
2016-03-01 20:10:17 +01:00
|
|
|
|
|
|
|
// Set a single LED to green
|
2017-08-30 15:00:29 -07:00
|
|
|
ledStrip.setLed(15, 31, 0, 255, 0);
|
2016-03-01 20:10:17 +01:00
|
|
|
|
|
|
|
//! [Interesting]
|
|
|
|
return 0;
|
|
|
|
}
|