Hi All..
Totally new to arduino and neopixel,.
I have got as far as finding example code and playing with values etc..
However I cannot find an example even close to what I am trying to achieve..
I work in the events industry so I'm totally out of work now maybe till 2022 and I am busying myself trying to learn arduino neopixel for some projects I am trying to keep myself sane with..
For this project I want to have strips of about 24 in each and for the LEDs to light from one end in a fade to fill the bar as if the bar is being heated up from one end and the glow is slowly filling up the bar from one end untill all of the bar is hot then it cools down back to the energy giving end and so on
..I want to cut the strip and extend it at pixel 25 for instance depending on how long I make the rods and repeat the pattern or sequence in the next 25 so as I can just extend and make other rods that work in sync together..
Can anyone point me to any example codes that I can easely play with to achieve that effect or give me some pointers on where to start writing a code that does this please ??
Thanks in advance..
Dave..
In a real metal bar, one end of the bar would be in contact with the heat source, and heat would flow from the heat source, when present/on, into the first part of the bar. The rate of that flow would depend on the difference in temperature between the heat source and the first part of the bar and the thermal conductivity between the heat source and the bar material. The bigger the temp difference, the faster the flow of heat into the first part of the bar. But also at the same time, heat will flow out of the first part of the bar into the next part of the bar, the rate of flow again being determined by the temperature difference. All the while, heat would be lost from the bar into the environment, but at a slower rate, because the thermal conductivity with the air is likely to be much lower than in the bar.
So I would model the bar in 24 sections and model heat energy entering or leaving each section, depending on the temperature of the adjacent sections, and escaping into the environment. The total amount of heat energy in any section is its temperature.
Does that help?
Thank you so much for your reply... I mentioned heat in a bar as this is the best description I can give to the effect I am trying to achieve.. the glow slowly traveling up the bar whilst at the heat end the glow gets brighter as the glow travels into the bar,,
for my project however this energy will be represented as a green energy and the energy will rise and drop over just just five or six seconds,,
No problem, you can have any colour you want, and it should be possible to adjust the pattern to your desired 5s interval by playing around with adjusting the factors modelling the "thermal conductivity" of the "bar" and with the environment. Have a try to write the code and post it here if you need more help.
A friend sent me this code,,, this is defiantly the effect I want to achieve however I now need to repeat this pattern another four times maybe more up the strip so as I can make other bars by extending the LED strip..
// I GUESS YOU NEED TO IMPORT THE fastLED Library here?
#include <FastLED.h>
// Set the pin your NeoPixels are attached to here
#define DATA_PIN 3
// Set the number of LEDS
#define NUM_LEDS 25
// Set the number of steps in the
// transition from off to on (no more than 255)
int TRANSITION_LENGTH=155;
//Set the speed of the transition (this is the delay on each frame of the animation, in milliseconds)
int DELAY_SPEED=20;
// Now we need to create an array to store all our values.
// The length of the array will be the transition length, plus twice the number of LEDs
const int ARRAY_LENGTH=305;
int brightnessMap[305];
int offset=0; //Variable stores the offest for the brightness map
int dir=0; //Variable stores the direction of the transition
CRGB leds[NUM_LEDS];
void setup() {
// I don't know if this bit will work - just using the documentation
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
// Create an array to hold all of our values from a
// full set of "on" to a full set of "off" LEDs
// Calculate all the values and populate the array
for(int i=0; i < NUM_LEDS; i++){
// This loop fills the first section of the map to fully on
brightnessMap*=255;*
- }*
- for(int i=0; i<TRANSITION_LENGTH; i++){*
- // This loop calculates the brightnesses at each stage in the transition*
- brightnessMap[i+NUM_LEDS]=map(i, 0, TRANSITION_LENGTH, 255, 0);*
- }*
- for(int i=ARRAY_LENGTH-NUM_LEDS; i<ARRAY_LENGTH; i++){ *
- // This loop fills the last section of the map to fully off*
_ brightnessMap*=0;_
_ }_
_}_
void loop() {
_ // put your main code here, to run repeatedly:_
_ for(int i=0; i<25; i++){ //Loop through the LEDs*_
* int brightness=brightnessMap[i+offset]; // Pick the relevant brightness from the brightness map we generated*
* int ledNumber=i;*
* // ------*
* // IN THIS BIT YOU NEED TO ASSIGN THE BRIGHTNESS USING THE VARIABLE 'brightness'*
* // TO THE RELEVANT LED NUMBER USING THE VARIABLE 'ledNumber'*
* leds[ledNumber].setRGB(0,brightness,0);*
* // ------*
* }*
* FastLED.show();*
* delay(DELAY_SPEED);
_ // Change the offset*_
* if(dir==0){ // if we're moving UP the brightness map*
* offset++; // Increase the offset by 1*
* if(offset>= NUM_LEDS+TRANSITION_LENGTH-1){ //If we reach full brightness*
* delay(30); //pause for half a second when everything is full brightness*
* dir=1; // Change the direction of the offset to decrease*
* }*
* } else { // If we're moving down the brightness map*
* offset--; // Decrease the offset by 1*
* if(offset<=0){ //If we reach full off*
* delay(1); //pause for half a second when everything is full darkness*
* dir=0; // Change direction of the offset to increase*
* }*
* }*
}
Great, I'm sure your friend will help with that too. Good luck.
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.