Hola, estoy usando una tira de led a la cual le quiero poner que se apague en una opción, cuando le añado esta línea:
if ( Efecto == 11) {
set_max_power_in_volt_and_milliamps(0,0);
}
}
me da este error,
exit status 1
'CambiarEfecto' was not declared in this scope
#include <FastLED.h>
//////////CONFIGURACIÓN///////////
#define LED_PIN 5
#define BUTTON_PIN 3
#define NUM_LEDS 15
#define BRIGHTNESS 200
#define LED_TYPE WS2812B
#define COLOR_ORDER GRB
CRGB leds[NUM_LEDS];
#define UPDATES_PER_SECOND 100
/////////////PARA DESARROLLADORES/////////////
CRGBPalette16 currentPalette;
TBlendType currentBlending;
int Efecto;
extern CRGBPalette16 myRedWhiteBluePalette;
extern const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM;
void setup() {
delay( 3000 ); // power-up safety delay
FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
FastLED.setBrightness( BRIGHTNESS );
currentPalette = RainbowColors_p;
currentBlending = LINEARBLEND;
Efecto = 0;
attachInterrupt(digitalPinToInterrupt(BUTTON_PIN), CambiarEfecto, RISING);
}
void loop()
{
ChangePalette();
static uint8_t startIndex = 0;
startIndex = startIndex + 1; /* motion speed */
FillLEDsFromPaletteColors( startIndex);
FastLED.show();
FastLED.delay(1000 / UPDATES_PER_SECOND);
}
void FillLEDsFromPaletteColors( uint8_t colorIndex)
{
uint8_t brightness = 255;
for ( int i = 0; i < NUM_LEDS; ++i) {
leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
colorIndex += 3;
}
}
// There are several different palettes of colors demonstrated here.
//
// FastLED provides several 'preset' palettes: RainbowColors_p, RainbowStripeColors_p,
// OceanColors_p, CloudColors_p, LavaColors_p, ForestColors_p, and PartyColors_p.
//
// Additionally, you can manually define your own color palettes, or you can write
// code that creates color palettes on the fly. All are shown here.
void ChangePalette()
{
if ( Efecto == 0) {
currentPalette = RainbowColors_p;
currentBlending = LINEARBLEND;
}
if ( Efecto == 1) {
currentPalette = RainbowStripeColors_p;
currentBlending = NOBLEND;
}
if ( Efecto == 2) {
currentPalette = RainbowStripeColors_p;
currentBlending = LINEARBLEND;
}
if ( Efecto == 3) {
SetupPurpleAndGreenPalette();
currentBlending = LINEARBLEND;
}
if ( Efecto == 4) {
currentPalette = ForestColors_p;
currentBlending = LINEARBLEND;
}
if ( Efecto == 5) {
SetupPurpleAndPurpleStripedPalette();
currentBlending = LINEARBLEND;
}
if ( Efecto == 6) {
currentPalette = RainbowColors_p;
currentBlending = LINEARBLEND;
}
if ( Efecto == 7) {
currentPalette = CloudColors_p;
currentBlending = LINEARBLEND;
}
if ( Efecto == 8) {
currentPalette = PartyColors_p;
currentBlending = LINEARBLEND;
}
if ( Efecto == 9) {
currentPalette = LavaColors_p;
currentBlending = LINEARBLEND;
}
if ( Efecto == 10) {
currentPalette = OceanColors_p;
currentBlending = LINEARBLEND;
}
}
if ( Efecto == 11) {
set_max_power_in_volt_and_milliamps(0,0);
}
}
void CambiarEfecto() {
if (Efecto >= 11)Efecto = 0;
else Efecto++;
}
// This function fills the palette with totally random colors.
void SetupTotallyRandomPalette()
{
for ( int i = 0; i < 16; ++i) {
currentPalette[i] = CHSV( random8(), 255, random8());
}
}
// This function sets up a palette of black and white stripes,
// using code. Since the palette is effectively an array of
// sixteen CRGB colors, the various fill_* functions can be used
// to set them up.
void SetupPurpleAndPurpleStripedPalette()
{
// 'black out' all 16 palette entries...
fill_solid( currentPalette, 16, CRGB::Purple);
// and set every fourth one to white.
currentPalette[0] = CRGB::Purple;
currentPalette[4] = CRGB::White;
currentPalette[8] = CRGB::White;
currentPalette[12] = CRGB::White;
}
// This function sets up a palette of purple and green stripes.
void SetupPurpleAndGreenPalette()
{
CRGB purple = CHSV( HUE_PURPLE, 255, 255);
CRGB green = CHSV( HUE_GREEN, 255, 255);
CRGB black = CRGB::Black;
currentPalette = CRGBPalette16(
green, green, black, black,
purple, purple, black, black,
green, green, black, black,
purple, purple, black, black );
}
// This example shows how to set up a static color palette
// which is stored in PROGMEM (flash), which is almost always more
// plentiful than RAM. A static PROGMEM palette like this
// takes up 64 bytes of flash.
const TProgmemPalette16 myRedWhiteBluePalette_p PROGMEM =
{
CRGB::Red,
CRGB::Gray, // 'white' is too bright compared to red and blue
CRGB::Blue,
CRGB::Black,
CRGB::Red,
CRGB::Gray,
CRGB::Blue,
CRGB::Black,
CRGB::Red,
CRGB::Red,
CRGB::Gray,
CRGB::Gray,
CRGB::Blue,
CRGB::Blue,
CRGB::Black,
CRGB::Black
};