22
22
23
23
#define BUTTON_PIN 4
24
24
25
+ // Hint: The ATmega32U4 does not have enough memory for 135 leds on both channels
25
26
CRGB ledsChannel1[135 ];
26
- CRGB ledsChannel2[135 ];
27
+ CRGB ledsChannel2[54 ];
27
28
28
29
CorsairLightingFirmware firmware = corsairLS100Firmware();
29
30
FastLEDController ledController (true );
@@ -32,25 +33,25 @@ CorsairLightingProtocolHID cHID(&cLP);
32
33
33
34
void setup () {
34
35
FastLED.addLeds <NEOPIXEL, DATA_PIN_CHANNEL_1>(ledsChannel1, 135 );
35
- FastLED.addLeds <NEOPIXEL, DATA_PIN_CHANNEL_2>(ledsChannel2, 135 );
36
+ FastLED.addLeds <NEOPIXEL, DATA_PIN_CHANNEL_2>(ledsChannel2, 54 );
36
37
ledController.addLEDs (0 , ledsChannel1, 135 );
37
- ledController.addLEDs (1 , ledsChannel2, 135 );
38
- pinMode (BUTTON_PIN, INPUT_PULLUP);
38
+ ledController.addLEDs (1 , ledsChannel2, 54 );
39
+ pinMode (BUTTON_PIN, INPUT_PULLUP);
39
40
}
40
41
41
42
void loop () {
42
43
static bool lightingEnabled = true ;
43
44
cHID.update ();
44
45
45
- if (buttonClicked ()) {
46
- lightingEnabled = !lightingEnabled;
47
- fill_solid (ledsChannel1, 135 , CRGB::Black);
48
- fill_solid (ledsChannel2, 135 , CRGB::Black);
49
- FastLED.show ();
50
- }
46
+ if (buttonClicked ()) {
47
+ lightingEnabled = !lightingEnabled;
48
+ fill_solid (ledsChannel1, 135 , CRGB::Black);
49
+ fill_solid (ledsChannel2, 54 , CRGB::Black);
50
+ FastLED.show ();
51
+ }
51
52
52
53
if (lightingEnabled && ledController.updateLEDs ()) {
53
- FastLED.show ();
54
+ FastLED.show ();
54
55
}
55
56
}
56
57
@@ -60,12 +61,12 @@ void loop() {
60
61
* @return true if the button was pressed and then released.
61
62
*/
62
63
bool buttonClicked () {
63
- static bool previousState = 1 ;
64
- bool state = digitalRead (BUTTON_PIN);
65
- if (previousState == 0 && state == 1 ) {
66
- previousState = state;
67
- return true ;
68
- }
69
- previousState = state;
70
- return false ;
64
+ static bool previousState = 1 ;
65
+ bool state = digitalRead (BUTTON_PIN);
66
+ if (previousState == 0 && state == 1 ) {
67
+ previousState = state;
68
+ return true ;
69
+ }
70
+ previousState = state;
71
+ return false ;
71
72
}
0 commit comments