im trying to merge the rainbow wave function in but getting an error, see below
void rainbow_wave() {
// fill_rainbow (struct CHSV *targetArray, int numToFill, uint8_t initialhue, uint8_t deltahue=5)
fill_rainbow (struct CHSV *targetArray, int numToFill, uint8_t initialhue, uint8_t deltahue=5);
my code
// Written like 3 months ago
// im lazy.
// Bw ~ ncea lvl 1 tech lAMP
// _ ^ _
// O O
// |
// <_____>
//
//
#include <FastLED.h>
#include <OneButton.h>
#define NUM_LEDS 86
#define LED_PIN 4
#define BTN_PIN 6
CRGB leds[NUM_LEDS];
uint8_t patternCounter = 0;
// Push button connected between pin 7 and GND (no resistor required)
OneButton btn = OneButton(BTN_PIN, true, true);
void setup() {
FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(50);
Serial.begin(57600);
btn.attachClick(nextPattern);
}
void loop() {
switch (patternCounter) {
case 0:
movingDots();
break;
case 1:
rainbow_wave();
break;
case 2:
White();
break;
}
FastLED.show();
btn.tick();
}
void nextPattern() {
patternCounter = (patternCounter + 1) % 3; // Change the number after the % to the number of patterns you have
}
//------- patterns. -------//
void movingDots() {
uint16_t posBeat = beatsin16(30, 0, NUM_LEDS - 1, 0, 0);
uint16_t posBeat2 = beatsin16(60, 0, NUM_LEDS - 1, 0, 0);
uint16_t posBeat3 = beatsin16(30, 0, NUM_LEDS - 1, 0, 32767);
uint16_t posBeat4 = beatsin16(60, 0, NUM_LEDS - 1, 0, 32767);
// Wave for LED color
uint8_t colBeat = beatsin8(45, 0, 255, 0, 0);
leds[(posBeat + posBeat2) / 2] = CHSV(colBeat, 255, 255);
leds[(posBeat3 + posBeat4) / 2] = CHSV(colBeat, 255, 255);
fadeToBlackBy(leds, NUM_LEDS, 10);
}
void rainbow_wave() {
// fill_rainbow (struct CHSV *targetArray, int numToFill, uint8_t initialhue, uint8_t deltahue=5)
fill_rainbow (struct CHSV *targetArray, int numToFill, uint8_t initialhue, uint8_t deltahue=5);
//void rainbowBeat() {
//uint16_t beatA = beatsin16(30, 0, 255);
//uint16_t beatB = beatsin16(20, 0, 255);
//fill_rainbow(leds, NUM_LEDS, (beatA+beatB)/2, 8);
}
void White() {
fill_solid( leds, NUM_LEDS, CRGB(50,0,200));
}
errors
Arduino: 1.8.15 (Mac OS X), Board: "Arduino Nano, ATmega328P (Old Bootloader)"
In file included from /Users/baileywilliams/Downloads/FastLED-basics-main 2/5. Multiple patterns/functionsButton/functionsButton.ino:12:0:
/Users/baileywilliams/Documents/Arduino/libraries/FastLED/src/FastLED.h:14:21: note: #pragma message: FastLED version 3.004.000
# pragma message "FastLED version 3.004.000"
^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/baileywilliams/Downloads/FastLED-basics-main 2/5. Multiple patterns/functionsButton/functionsButton.ino: In function 'void rainbow_wave()':
functionsButton:77:15: error: expected primary-expression before 'struct'
fill_rainbow (struct CHSV *targetArray, int numToFill, uint8_t initialhue, uint8_t deltahue=5);
^~~~~~
functionsButton:77:41: error: expected primary-expression before 'int'
fill_rainbow (struct CHSV *targetArray, int numToFill, uint8_t initialhue, uint8_t deltahue=5);
^~~
functionsButton:77:64: error: expected primary-expression before 'initialhue'
fill_rainbow (struct CHSV *targetArray, int numToFill, uint8_t initialhue, uint8_t deltahue=5);
^~~~~~~~~~
functionsButton:77:84: error: expected primary-expression before 'deltahue'
fill_rainbow (struct CHSV *targetArray, int numToFill, uint8_t initialhue, uint8_t deltahue=5);
^~~~~~~~
exit status 1
expected primary-expression before 'struct'
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.