Arduino sketch help needed

Arduino sketch help needed
0

#1

Hi All,
I am new to the forum and also new to Arduino so please bare with me.I have a sketch where I am trying to get a theaterchase effect to go one way when a temperature sensor is activated and the other way when the other sensor is activated.My sketch is below but I get errors when I try to compile it i.e fast was not declared in this scope.I think it is just (punctuation) but not sure.
If anyone can help it will be very much appreciated.
Thank you in advance

#include "FastLED.h"    //saved in magpi
#include <OneWire.h>
#include <DallasTemperature.h>
 
#define NUM_LEDS 300  //141 Reverse 150 forward


CRGB leds[NUM_LEDS];
#define PIN 6
#define ONE_WIRE_BUS 2

OneWire oneWire(ONE_WIRE_BUS);
 
DallasTemperature sensors(&oneWire);
 

void setup()
{
  sensors.setResolution(9);
  sensors.begin();
  
  FastLED.addLeds<WS2812B, PIN, GRB>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
}


void loop() {

  sensors.requestTemperatures();
  
//Serial.print(sensors.getTempCByIndex(0));
  if (sensors.getTempCByIndex(0) >= 25) {
   theaterChase ;
  }
  if (sensors.getTempCByIndex(1) >= 25) {
   fast ;
  }
}
  




void theaterChase(byte red, byte green, byte blue, int SpeedDelay) {

  for (int j=0; j<10; j++) {  //do 10 cycles of chasing

    for (int q=0; q < 6; q--) {   //reverse with -- or ++

      for (int i=0; i < NUM_LEDS; i=i+6) {

        setPixel(NUM_LEDS-(i+q), red, green, blue);    //turn every 6th pixel on

      }
    }
  }
      

      showStrip();

     delay(60);

     for (int i=0; i < NUM_LEDS; i=i+1) {   // delay ?

        setPixel(i+q , 0,0,0);        

      

    }

  }
} 

void fast(byte red, byte green, byte blue, int SpeedDelay) {

  for (int j=0; j<10; j++) {  //do 10 cycles of chasing

    for (int q=0; q < 6; q++) {   //reverse with -- or ++

      for (int i=0; i < NUM_LEDS; i=i+6) {

        setPixel(NUM_LEDS-(i+q), red, green, blue);    //turn every 6th pixel on

      }
   
    }
}
}


void showStrip() {

 #ifdef ADAFRUIT_NEOPIXEL_H 

   // NeoPixel

   strip.show();

 #endif

 #ifndef ADAFRUIT_NEOPIXEL_H

   // FastLED

   FastLED.show();

 #endif
}

void setPixel(int Pixel, byte red, byte green, byte blue) {

 #ifdef ADAFRUIT_NEOPIXEL_H 

   // NeoPixel

   strip.setPixelColor(Pixel, strip.Color(red, green, blue));

 #endif

 #ifndef ADAFRUIT_NEOPIXEL_H 

   // FastLED

   leds[Pixel].r = red;

   leds[Pixel].g = green;

   leds[Pixel].b = blue;

 #endif
}

void setAll(byte red, byte green, byte blue) {

  for (int i=NUM_LEDS; i >= 0; i=i-3) {

    setPixel(i, red, green, blue); 

  }

  showStrip();
}

#2

You might have better luck on an Arduino forum than here.

I’m not really knowledgeable in the way of the neopixel but here are a few observations / questions…

Have you been able to make this work in demo? Maybe as a reaction to button press instead of temp sensor? Do your function calls work - do they turn on neopixel when called?

Your loop appears to call call one of two functions based on sensor data. Are those valid function calls? Shouldn’t those calls have color parameters, etc?
Something like theaterChase(strip.Color(127, 127, 127), delayTime);

Did you also get a similar error message for theaterChase?
Did you download the fast LED Library?