FastLED blinking via max.msp

Hi,

I’m working on a variable speed strobe using max/msp and an Arduino.

Max toggles a 1 and 0 through the serial and the led blinks using the attached code (1)

I’ve just started working with WS2812Bs using FastLED.

From a YouTube tutorial I’ve extracted the second code.

I’ve tried to combine the two codes using the setbrightness function to blink (3).

I’m getting error message:
no matching function for call to ‘CFastLED::setBrightness(int, int)’
else {FastLED.setBrightness(LED_PIN, 0);
^
Am I going about the problem in the wrong way?

Thanks in advance for any help.

strobe_sketch.ino (209 Bytes)

FastLED_1.ino (338 Bytes)

flicker_FastLED_1.ino (540 Bytes)

OK, read the instructions as to how to post your code so we can examine it conveniently. :grinning:

Will do Paul.

Code 1

void setup() {pinMode(13, OUTPUT);
Serial.begin(9600);
}

void loop() { 
if (Serial.available() > 0) {
int Light = Serial.parseInt();
if (Light == 1) {digitalWrite(13, HIGH);}
else {digitalWrite(13, LOW);}
}}

Code 2

#include <FastLED.h>

#define NUM_LEDS 8
#define LED_PIN 5

int LEDbPin=3;
CRGB leds[NUM_LEDS];

uint8_t hue = 0;

void setup() {
  FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
  FastLED.setBrightness(50);
  
}
 
void loop() {
  for (int i = 0; i < NUM_LEDS; i++) {
    leds[i] = CHSV(hue, 255, 255);
  }
   FastLED.show();
}

Code 3

#include <FastLED.h>

#define NUM_LEDS 8
#define LED_PIN 5

CRGB leds[NUM_LEDS];

uint8_t hue = 0; 

void setup() {
  // put your s0etup code here, to run once:
Serial.begin(9600);

FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
  FastLED.setBrightness(50);
}

void loop() {

  for (int i = 0; i < NUM_LEDS; i++) {
    leds[i] = CHSV(hue, 255, 255);
  }
if (Serial.available() > 0) {
int Light = Serial.parseInt();
if (Light == 1) {FastLED.setBrightness(LED_PIN, 100);}
else {FastLED.setBrightness(LED_PIN, 0);
}
FastLED.show();
}

Can't spot a problem.

I would be inclined to cut and paste that function "FastLED.setBrightness(LED_PIN, 0);" - in case of a spurious embedded character - into a test sketch to see if that version actually compiles.

I tried copy and pasting and re-writing code.

#include <FastLED.h>

#define NUM_LEDS 8
#define LED_PIN 5

CRGB leds[NUM_LEDS];

uint8_t hue = 0;

void setup() {
  Serial.begin(9600);

  FastLED.addLeds<WS2812B, LED_PIN,GRB>(leds,NUM_LEDS);
  FastLED.setBrightness(50);
}

void loop() {

  for (int i = 0; i < NUM_LEDS; i++) {
    leds[i] = CHSV(hue, 120, 255);
  }
  FastLED.setBrightness(LED_PIN,255);
  FastLED.show();
}

Still same error message.
A “C” seems to be added each time before FastLED.Brightness.
Copy and pasted into Text Edit and no sign of the “C”.

Any more ideas?