Hello all.
I have some RGB code that runs on a Teesny 3.2.
At boot, it randomly illuminates the RGB during setup in a colour (varies). I cannot see why.
PSU is a nice dedicated 5v unit I have used many times, and it also does it off the bench supply. Any ideas?
I was informed that Fastled.clear(); wasn't a good way to clear / turn off the LEDS?
So I tried the Fill_solid command and got the same result.
I know it's in setup, as if I stop the code at the end of setup, the RGB are already lit.
Once in the main loop, it seems to behave. Sorry for the patchy code, I am at work and writing this from memory.
Noise on the RGB data line? It's only 300mm long and never suffered with that before.
Last few times, it has actually frozen the Teensy and I have had to re-program it as it would not reset. What could cause that?
When it runs (which is most of the time), it runs fine.
Hmm
I have some RGB code that runs on a Teesny 3.2.
At boot, it randomly illuminates the RGB during setup in a colour (varies). I cannot see why.
PSU is a nice dedicated 5v unit I have used many times, and it also does it off the bench supply. Any ideas?
I was informed that Fastled.clear(); wasn't a good way to clear / turn off the LEDS?
So I tried the Fill_solid command and got the same result.
I know it's in setup, as if I stop the code at the end of setup, the RGB are already lit.
Once in the main loop, it seems to behave. Sorry for the patchy code, I am at work and writing this from memory.
Noise on the RGB data line? It's only 300mm long and never suffered with that before.
Last few times, it has actually frozen the Teensy and I have had to re-program it as it would not reset. What could cause that?
When it runs (which is most of the time), it runs fine.
Hmm
Code:
#include <Audio.h>
#include <Bounce2.h>
#include <FastLED.h>
#include <SD.h>
#include <SPI.h>
#include <Wire.h>
// GUItool: begin automatically generated code
AudioPlaySdWav playSdWav1; // xy=220,240
AudioPlaySdWav playSdWav2; // xy=224,305
AudioMixer4 mixer1; // xy=434,271
AudioEffectFade fade1; // xy=600,272
AudioOutputI2S i2s1; // xy=774,272
AudioConnection patchCord1(playSdWav1, 0, mixer1, 0);
AudioConnection patchCord2(playSdWav2, 0, mixer1, 1);
AudioConnection patchCord3(mixer1, fade1);
AudioConnection patchCord4(fade1, 0, i2s1, 0);
AudioControlSGTL5000 sgtl5000_1; // xy=372,166
// GUItool: end automatically generated code
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14
#define switch 2 // Microswitch
#define MyLEDS 5 // RGB Leds
#define LED_TYPE WS2812 // Set up the RGB Leds
#define COLOR_ORDER GRB
#define MY_NUM_LEDS 12 // Number of LEDS
uint8_t LEDS_Brightness = 255; // Switch LED brightness
CRGB MY_RGB_LEDS[MY_NUM_LEDS];
Bounce bounce = Bounce();
uint16_t debouncedInput = HIGH;
#define FRAMES_PER_SECOND 120
//------------------------------------------------ SETUP ----------------------------------------------------------
void setup(void)
{
pinMode(MyLEDS, OUTPUT);
bounce.attach(switch, INPUT_PULLUP); // USE INTERNAL PULL-UP
bounce.interval(5); // interval in ms
Serial.begin(115200); // Debug serial comms port
AudioMemory(8);
sgtl5000_1.enable();
sgtl5000_1.volume(0.7);
FastLED.addLeds<LED_TYPE, MYLEDS, COLOR_ORDER>(MY_RGB_LEDS, MY_NUM_LEDS).setCorrection(TypicalLEDStrip);
delay(5);
FastLED.setBrightness(LEDS_Brightness);
FastLED.clear();
FastLED.show();
SPI.setMOSI(SDCARD_MOSI_PIN); // Setup SD card for sound
SPI.setSCK(SDCARD_SCK_PIN);
if (!(SD.begin(SDCARD_CS_PIN)))
{
while (1)
{
Serial.println("Unable to access the SD card");
delay(250);
}
}
}
//############################################### MAIN LOOP ########################################################