Ви не увійшли.
есть небольшой скетч, так же есть 2 платы wemos d1 r1 mini и arduino nano, а так же среда разработки Proteus и лучевая матрица с 16 лучами по 8 светодиодов в луче
собрал проект в Proteus на arduino nano, запустил, все работает как надо. собрал макет в реальности, решил поставить wemos (arduino выступала в качестве программатора для других целей). скомпилировал, загрузил скетч и.... отображение разных световых эффектов выводилось с очень замедленной скоростью, даже можно сказать с рывками. решил попробовать arduino, загрузил включил и....... отображение было плавным, ровным, но в ускоренном режиме, некоторые световые эффекты отображались по 2-3 сек и сменялись на другие. в чем подвох???????????
#include "FastLED.h" // FastLED library.
#if FASTLED_VERSION < 3001000
#error "Requires FastLED 3.1 or later; check github for latest code."
#endif
// Fixed definitions cannot change on the fly.
#define LED_DT 5 // Data pin to connect to the strip.
#define LED_CK 11
#define COLOR_ORDER BGR // It's GRB for WS2812B and BGR for APA102
#define LED_TYPE WS2812 // What kind of strip are you using (WS2801, WS2812B or APA102)?
#define NUM_LEDS 8*16 // Number of LED's.
// Initialize changeable global variables.
uint8_t max_bright = 250; // Overall brightness definition. It can be changed on the fly.
struct CRGB leds[NUM_LEDS]; // Initialize our LED array.
// Initialize global variables for sequences
uint8_t retard = 5; // A delay value for the sequence(s)
uint8_t valeur_teinte_pixels = 0; // Starting hue value.
int8_t rotation = 1; // Hue rotation speed. Includes direction.
uint8_t Changement_teinte_pixels = 1; // Hue change between pixels.
bool variable_direction = 0; // I use a direction variable instead of signed math so I can use it in multiple routines.
void setup() {
//Serial.begin(115200); // Initialize serial port for debugging.
//delay(1000); // Soft startup to ease the flow of electrons.
LEDS.addLeds<LED_TYPE, LED_DT, COLOR_ORDER>(leds, NUM_LEDS); // Use this for WS2812B
//LEDS.addLeds<LED_TYPE, LED_DT, COLOR_ORDER>(leds, NUM_LEDS); // Use this for WS2801 or APA102
FastLED.setBrightness(max_bright);
//set_max_power_in_volts_and_milliamps(5, 1000); // FastLED 2.1 Power management set at 5V, 500mA
} // setup()
void loop () {
ChangeMe();
EVERY_N_MILLISECONDS(retard) { // FastLED based non-blocking delay to update/display the sequence.
rainbow_march();
}
FastLED.show();
} // loop()
void rainbow_march() { // The fill_rainbow call doesn't support brightness levels. You would need to change the max_bright value.
if (variable_direction == 0) valeur_teinte_pixels += rotation;
else valeur_teinte_pixels-= rotation; // I could use signed math, but 'variable_direction' works with other routines.
fill_rainbow(leds, NUM_LEDS, valeur_teinte_pixels, Changement_teinte_pixels); // I don't change Changement_teinte_pixels on the fly as it's too fast near the end of the strip.
} // rainbow_march()
void ChangeMe() { // A time (rather than loop) based demo sequencer. This gives us full control over the length of each sequence.
uint8_t secondHand = (millis() / 1000) % 60; // Change '60' to a different value to change length of the loop.
static uint8_t lastSecond = 99; // Static variable, means it's only defined once. This is our 'debounce' variable.
if (lastSecond != secondHand) { // Debounce to make sure we're not repeating an assignment.
lastSecond = secondHand;
switch(secondHand) {
case 0: rotation=1; Changement_teinte_pixels=5; break;
case 1: rotation=3; Changement_teinte_pixels=15; break;
case 2: rotation=6; Changement_teinte_pixels=25; break;
case 3: rotation=9; Changement_teinte_pixels=35; break;
//
case 4: rotation=3; Changement_teinte_pixels=5; break;
case 5: rotation=4; Changement_teinte_pixels=10; break;
case 6: rotation=5; Changement_teinte_pixels=15; break;
case 7: rotation=6; Changement_teinte_pixels=20; break;
//
case 10: rotation=5; break;
case 11: rotation=10; break;
case 12: rotation=15; break;
case 13: rotation=20; break;
//
case 15: rotation=5; variable_direction=-1; Changement_teinte_pixels=10; break;
case 16: rotation=6; variable_direction=-2; Changement_teinte_pixels=15; break;
case 17: rotation=7; variable_direction=-3; Changement_teinte_pixels=20; break;
case 18: rotation=8; variable_direction=-4; Changement_teinte_pixels=25; break;
case 19: rotation=9; variable_direction=-5; Changement_teinte_pixels=30; break;
//
case 20: Changement_teinte_pixels=30; break;
case 21: Changement_teinte_pixels=50; break;
case 22: Changement_teinte_pixels=70; break;
//
case 25: Changement_teinte_pixels=2; rotation=5; break;
case 26: Changement_teinte_pixels=5; rotation=15; break;
case 27: Changement_teinte_pixels=7; rotation=25; break;
case 30: break;
}
}
} // ChangeMe()
Неактивний