Hi I need the support of a talented programmer, I have been working on this for weeks now with no working results, I even tried someone on Fiverr and no working results, I just can't get the animations as required in the combined code. I require them to combine their animations all running simultaneously with the required output. I have no idea what the going rate is.
for one WS2812 I can not get the full animation to run in one shetct. so I need to combine the 2 together for one strip of 12, and then add 15 LEDs on a different strip of WS2812 and then possibly add a third segment of 26 LEDs on a strip of WS2812B. Arduino Nano.
Im not even sure if the sketches are compatible, but each section gives an out-put I an looking for.
Section 1 Part A to combine with Part B to run simultaneously but inherently with Part B
// Led 11 and 0 Strobe Red to White with incresed brightness.
// Paart 1 A
// Including the FastLED library
#include <FastLED.h>
// Define constants for the LED strip setup
#define NUM_LEDS_1 12 // Total number of LEDs in the strip
#define DATA_PIN_1 7 // Data pin where the LED strip is connected
#define COLOR_ORDER GRB // Color order of the LEDs (Green, Red, Blue)
#define CHIPSET_1 WS2812 // LED chipset used (WS2812)
#define BRIGHTNESS_2 1 // Brightness level (1 out of maximum brightness)
#define VOLTS 5 // Operating voltage for the LED strip (5V)
#define MAX_AMPS 500 // Maximum current consumption in milliamps (500 mA)
// Creating an array to store LED colors
CRGB leds[NUM_LEDS_1];
// Variables to track time intervals
unsigned long previousMillisLed0 = 0;
unsigned long currentMillis; // Variable to hold the current time
// Time intervals for different LED animations
const long interval1 = 60;
const long interval0 = 500;
const long interval5 = 500;
// State variables for LEDs
bool stateLed0 = true;
bool stateLed11 = true;
// Setup function runs once at the beginning
void setup() {
// Adding LED strip configuration
FastLED.addLeds<CHIPSET_1, DATA_PIN_1, COLOR_ORDER>(leds, NUM_LEDS_1);
// Setting maximum power consumption for LEDs
FastLED.setMaxPowerInVoltsAndMilliamps(VOLTS, MAX_AMPS);
// Setting LED brightness
FastLED.setBrightness(BRIGHTNESS_2);
// Clearing all LEDs
FastLED.clear();
}
// Main loop that runs repeatedly
void loop() {
// Animation for turning off LED 10 after 400 ms
if (stateLed0 && (millis() - previousMillisLed0 >= 400)) {
leds[10] = CRGB::Black; // Turn off LED 10 by setting its color to black
FastLED.show(); // Update the LED strip
stateLed0 = false; // Update the state variable for LED 10
}
// Updating currentMillis to track time
currentMillis = millis();
// Loop for animating LEDs from index 10 to 1
for (int i = 10; i > 1; i--) {
leds[i] = CRGB(255, 255, 255); // Set the color of the LED at index i to white
FastLED.show(); // Update the LED strip with the new colors
// Waiting for a specific interval (interval1)
while (millis() - currentMillis < interval1) {
// This loop ensures that the LED remains white for 'interval1' milliseconds
}
currentMillis = millis(); // Update the current time marker
}
// Setting LED 1 color to orange and showing it
leds[1] = CRGB(255, 120, 0); // Set LED 1 color to orange
FastLED.show(); // Update the LED strip
// Waiting for a specific interval (interval1)
while (millis() - currentMillis < interval1) {
// This loop ensures that the orange color remains for 'interval1' milliseconds
}
currentMillis = millis(); // Update the current time marker
// Changing LED 1 color to red and showing it
leds[1] = CRGB(255, 0, 0); // Set LED 1 color to red
FastLED.show(); // Update the LED strip
// Waiting for a specific interval (approximately 250 ms)
while (millis() - currentMillis < 250) {
// This loop ensures that the red color remains for approximately 250 ms
}
currentMillis = millis(); // Update the current time marker
// Changing LED 1 color to a different shade of orange and showing it
leds[1] = CRGB(255, 70, 0); // Set LED 1 color to a different shade of orange
FastLED.show(); // Update the LED strip
// Waiting for a specific interval (approximately 250 ms)
while (millis() - currentMillis < 250) {
// This loop ensures that the new shade of orange color remains for approximately 250 ms
}
// Clearing all LEDs
FastLED.clear(); // Turn off all LEDs
}
Part B
// Led 11 and 0 Strbe red to White
Section 1 Part B
// Including the FastLED library
#include <FastLED.h>
// Define constants for the LED strip setup
#define NUM_LEDS_1 12 // Total number of LEDs in the strip
#define DATA_PIN_1 7 // Data pin where the LED strip is connected
#define COLOR_ORDER GRB // Color order of the LEDs (Green, Red, Blue)
#define CHIPSET_1 WS2812 // LED chipset used (WS2812)
#define BRIGHTNESS_2 1 // Brightness level (1 out of maximum brightness)
#define VOLTS 5 // Operating voltage for the LED strip (5V)
#define MAX_AMPS 500 // Maximum current consumption in milliamps (500 mA)
// Creating an array to store LED colors
CRGB leds[NUM_LEDS_1];
// Variables to track time intervals
unsigned long previousMillisLed0 = 0;
unsigned long currentMillis; // Variable to hold the current time
// Time intervals for different LED animations
const long interval1 = 60;
const long interval0 = 500;
const long interval5 = 500;
// State variables for LEDs
bool stateLed0 = true;
bool stateLed11 = true;
// Setup function runs once at the beginning
void setup() {
// Adding LED strip configuration
FastLED.addLeds<CHIPSET_1, DATA_PIN_1, COLOR_ORDER>(leds, NUM_LEDS_1);
// Setting maximum power consumption for LEDs
FastLED.setMaxPowerInVoltsAndMilliamps(VOLTS, MAX_AMPS);
// Setting LED brightness
FastLED.setBrightness(BRIGHTNESS_2);
// Clearing all LEDs
FastLED.clear();
}
// Main loop that runs repeatedly
void loop() {
// Animation for turning off LED 10 after 400 ms
if (stateLed0 && (millis() - previousMillisLed0 >= 400)) {
leds[10] = CRGB::Black; // Turn off LED 10 by setting its color to black
FastLED.show(); // Update the LED strip
stateLed0 = false; // Update the state variable for LED 10
}
// Updating currentMillis to track time
currentMillis = millis();
// Loop for animating LEDs from index 10 to 1
for (int i = 10; i > 1; i--) {
leds[i] = CRGB(255, 255, 255); // Set the color of the LED at index i to white
FastLED.show(); // Update the LED strip with the new colors
// Waiting for a specific interval (interval1)
while (millis() - currentMillis < interval1) {
// This loop ensures that the LED remains white for 'interval1' milliseconds
}
currentMillis = millis(); // Update the current time marker
}
// Setting LED 1 color to orange and showing it
leds[1] = CRGB(255, 120, 0); // Set LED 1 color to orange
FastLED.show(); // Update the LED strip
// Waiting for a specific interval (interval1)
while (millis() - currentMillis < interval1) {
// This loop ensures that the orange color remains for 'interval1' milliseconds
}
currentMillis = millis(); // Update the current time marker
// Changing LED 1 color to red and showing it
leds[1] = CRGB(255, 0, 0); // Set LED 1 color to red
FastLED.show(); // Update the LED strip
// Waiting for a specific interval (approximately 250 ms)
while (millis() - currentMillis < 250) {
// This loop ensures that the red color remains for approximately 250 ms
}
currentMillis = millis(); // Update the current time marker
// Changing LED 1 color to a different shade of orange and showing it
leds[1] = CRGB(255, 70, 0); // Set LED 1 color to a different shade of orange
FastLED.show(); // Update the LED strip
// Waiting for a specific interval (approximately 250 ms)
while (millis() - currentMillis < 250) {
// This loop ensures that the new shade of orange color remains for approximately 250 ms
}
// Clearing all LEDs
FastLED.clear(); // Turn off all LEDs
}
Other WS2812 15 LEDs, to have different pin
// Flip Flop Code modified code from youtube
// leds 15 to 0
// Including the FastLED library
#include <FastLED.h>
// Define constants for the LED strip setup
#define NUM_LEDS_1 12 // Total number of LEDs in the strip
#define DATA_PIN_1 7 // Data pin where the LED strip is connected
#define COLOR_ORDER GRB // Color order of the LEDs (Green, Red, Blue)
#define CHIPSET_1 WS2812 // LED chipset used (WS2812)
#define BRIGHTNESS_2 1 // Brightness level (1 out of maximum brightness)
#define VOLTS 5 // Operating voltage for the LED strip (5V)
#define MAX_AMPS 500 // Maximum current consumption in milliamps (500 mA)
// Creating an array to store LED colors
CRGB leds[NUM_LEDS_1]; // Array to store colors for each LED
// Variables to track time intervals
unsigned long previousMillisLed0 = 0; // Previous time marker for LED 10 animation
unsigned long currentMillis; // Variable to hold the current time
// Time intervals for different LED animations
const long interval1 = 60; // Interval for various animations
const long interval0 = 500; // Longer interval
const long interval5 = 500; // Another interval
// State variables for LEDs
bool stateLed0 = true; // State of LED 10 (on or off)
bool stateLed11 = true; // State of LED 11 (not used in this code)
// Setup function runs once at the beginning
void setup() {
// Adding LED strip configuration
FastLED.addLeds<CHIPSET_1, DATA_PIN_1, COLOR_ORDER>(leds, NUM_LEDS_1);
// Setting maximum power consumption for LEDs
FastLED.setMaxPowerInVoltsAndMilliamps(VOLTS, MAX_AMPS);
// Setting LED brightness
FastLED.setBrightness(BRIGHTNESS_2);
// Clearing all LEDs
FastLED.clear();
}
// Main loop that runs repeatedly
void loop() {
// Animation for turning off LED 10 after 400 ms
if (stateLed0 && (millis() - previousMillisLed0 >= 400)) {
leds[10] = CRGB::Black; // Turn off LED 10 by setting its color to black
FastLED.show(); // Update the LED strip
stateLed0 = false; // Update the state variable for LED 10
}
// Updating currentMillis to track time
currentMillis = millis();
// Loop for animating LEDs from index 10 to 1
for (int i = 10; i > 1; i--) {
leds[i] = CRGB(255, 255, 255); // Set the color of the LED at index i to white
FastLED.show(); // Update the LED strip with the new colors
// Waiting for a specific interval (interval1)
while (millis() - currentMillis < interval1) {
// This loop ensures that the LED remains white for 'interval1' milliseconds
}
currentMillis = millis(); // Update the current time marker
}
// Setting LED 1 color to orange and showing it
leds[1] = CRGB(255, 120, 0); // Set LED 1 color to orange
FastLED.show(); // Update the LED strip
// Waiting for a specific interval (interval1)
while (millis() - currentMillis < interval1) {
// This loop ensures that the orange color remains for 'interval1' milliseconds
}
currentMillis = millis(); // Update the current time marker
// Changing LED 1 color to red and showing it
leds[1] = CRGB(255, 0, 0); // Set LED 1 color to red
FastLED.show(); // Update the LED strip
// Waiting for a specific interval (approximately 250 ms)
while (millis() - currentMillis < 250) {
// This loop ensures that the red color remains for approximately 250 ms
}
currentMillis = millis(); // Update the current time marker
// Changing LED 1 color to a different shade of orange and showing it
leds[1] = CRGB(255, 70, 0); // Set LED 1 color to a different shade of orange
FastLED.show(); // Update the LED strip
// Waiting for a specific interval (approximately 250 ms)
while (millis() - currentMillis < 250) {
// This loop ensures that the new shade of orange color remains for approximately 250 ms
}
// Clearing all LEDs
FastLED.clear(); // Turn off all LEDs
}
Lastly, this code using WS2812B but needs this to also have a pin in to run a High Low function
// Sketch uses 5530 bytes (18%) of program storage space. Maximum is 30720 bytes.
// Global variables use 359 bytes (17%) of dynamic memory, leaving 1689 bytes for local variables. Maximum is 2048 bytes.
#include <Arduino.h>
#include <FastLED.h>
// Define the number of LEDs in the strip and the data pin for controlling the LED strip
#define NUM_LEDS 26 // Number of LEDs in the LED strip
#define DATA_PIN 2 // Digital pin connected to the LED data input
// Define the color order and chipset type for the LED strip
#define COLOR_ORDER GRB // Color order of the LED strip (Green, Red, Blue)
#define CHIPSET WS2812B // LED chipset type (WS2812B is a common type)
// Define the analog input pin for voltage measurement
#define inputPin A0 // Analog input pin for voltage measurement
// Create an array to hold LED colors
CRGB leds[NUM_LEDS]; // Array to store LED colors
// Variable to track if the signal is high (voltage >= 3.0)
bool signalHigh = false; // Used to track signal state
// Variables for timing LED updates
unsigned long previousMillis = 0; // Variable to store the last time LEDs were updated
const unsigned long interval = 1000; // Interval for LED updates (1 second)
// Function to set up the Arduino
void setup() {
// Initialize the LED strip using FastLED library
FastLED.addLeds<CHIPSET, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);
// Initialize serial communication for debugging
Serial.begin(9600);
// Wait for the input voltage to transition from low to high (3.0 volts)
while (analogRead(inputPin) < 3.0) {
// Optional: Add actions here to indicate that the program is waiting.
// For example, blink an LED or send a message over serial.
delay(500);
}
// Input has transitioned from low to high, set LEDs to purple with brightness 1
fill_solid(leds, NUM_LEDS, CRGB::Purple); // Set all LEDs to purple
FastLED.setBrightness(1); // Set LED brightness to 1
FastLED.show(); // Display the color on the LEDs
previousMillis = millis(); // Record the current time
}
// Main loop for the Arduino
void loop() {
// Read the analog input value
int inputValue = analogRead(inputPin);
// Convert the analog input value to voltage (assuming a 5V reference)
float voltage = inputValue * (5.0 / 1023.0);
// Get the current time
unsigned long currentMillis = millis();
// Check if it's time to update the LEDs
if (currentMillis - previousMillis >= interval) {
// Update the previousMillis to the current time
previousMillis = currentMillis;
if (!signalHigh && voltage >= 3.0 && voltage <= 5.0) {
signalHigh = true;
// Turn LEDs purple with brightness 1
fill_solid(leds, NUM_LEDS, CRGB::Purple);
FastLED.setBrightness(1);
FastLED.show();
} else if (signalHigh && voltage < 2.0) {
signalHigh = false;
// Turn off LEDs and set brightness to 1
fill_solid(leds, NUM_LEDS, CRGB::Black);
FastLED.show();
FastLED.setBrightness(1);
}
}
// If the signal is high, keep LEDs purple with brightness 1
if (signalHigh) {
fill_solid(leds, NUM_LEDS, CRGB::Purple);
FastLED.show();
}
}
I have a schematic and some videos showing the output
Please any assistance even if I can just get the first 2 elements to run, I just cant get my head around it even after reading and asking.