Skip to content

Commit 6ceb86f

Browse files
authored
Merge pull request #88 from Legion2/non-addressable
Added example for non addressable LED strips
2 parents 0cfd1a8 + 8fd527a commit 6ceb86f

File tree

3 files changed

+59
-1
lines changed

3 files changed

+59
-1
lines changed

.github/workflows/push.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jobs:
66
runs-on: ubuntu-latest
77
strategy:
88
matrix:
9-
sketch: [LightingNodePRO, SingleStripLightingNodePRO, CommanderPRO, DeviceIDTool, RepeatAndScale, TransformLLFansFormatToStrip, LS100, LightingNodeCORE]
9+
sketch: [LightingNodePRO, SingleStripLightingNodePRO, CommanderPRO, DeviceIDTool, RepeatAndScale, TransformLLFansFormatToStrip, LS100, LightingNodeCORE, NonAddressable]
1010
board: ["arduino:avr:leonardo", "arduino:avr:micro", "SparkFun:avr:promicro:cpu=16MHzatmega32U4"]
1111
steps:
1212
- uses: actions/checkout@master
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
Copyright 2019 Leon Kiefer
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
#include <CorsairLightingProtocol.h>
17+
#include <FastLED.h>
18+
19+
// The Arduino pin where the physical LEDs are connected.
20+
// Must be PWM pins
21+
#define RED_PIN 3
22+
#define GREEN_PIN 5
23+
#define BLUE_PIN 6
24+
25+
CorsairLightingFirmware firmware = corsairLightingNodePROFirmware();
26+
FastLEDController ledController(true);
27+
CorsairLightingProtocolController cLP(&ledController, &firmware);
28+
CorsairLightingProtocolHID cHID(&cLP);
29+
30+
CRGB ledsChannel1[10];
31+
32+
void setup() {
33+
pinMode(RED_PIN, OUTPUT);
34+
pinMode(GREEN_PIN, OUTPUT);
35+
pinMode(BLUE_PIN, OUTPUT);
36+
ledController.addLEDs(0, ledsChannel1, 10);
37+
ledController.onUpdateHook(0, []() {
38+
// use color of first LED of the first channel
39+
set4PinLEDs(ledsChannel1[0]);
40+
});
41+
}
42+
43+
void loop() {
44+
cHID.update();
45+
ledController.updateLEDs();
46+
}
47+
48+
void set4PinLEDs(const CRGB& color) {
49+
analogWrite(RED_PIN, color.r);
50+
analogWrite(GREEN_PIN, color.g);
51+
analogWrite(BLUE_PIN, color.b);
52+
}

examples/NonAddressable/board.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# CorsairLightingProtocol build property overrides
2+
3+
build.vid=0x1b1c
4+
build.pid=0x0c0b
5+
build.usb_product="Lighting Node PRO"
6+
build.usb_manufacturer="Corsair"

0 commit comments

Comments
 (0)