hi , i have problem and i described before my project
i have 2 button
i have 2 segnents in 1 strip
i described into 2 mode when button pressed
and my questions its :
how i can use sync lightspeed instead of 2 segments
for example
ws2812fx.setSegments(0,0,4,light_mode_number ,colour_hex_code ,speed);
ws2812fx.setSegments(1,5,9,light_mode_number ,colour_hex_code ,speed)
then after i pressed the button between segment 1 and 2 its different light and not same (if button pressed 1 segments its change light mode .
any ideas??
any full example code for sync 2 segments??
Your questions will make sense, perhaps, if you post the code.
It says this is your first list, you seem to say you've asked about this matter before.
Please use the Auto Format tool in the IDE, the the Copy for Forum tool in the IDE and paste here a complete sketch that compiles and runs.
Say what it does that it should'nt, or does not do that it should.
TIA
a7
heres is my code
#include <WS2812FX.h>
#define LED_PIN 2 // digital pin used to drive the LED strip
#define LED_COUNT 9 // number of LEDs on the strip
int button_A = 5;
int button_B = 7;
int val_A = 0;
int val_B = 0;
WS2812FX ws2812fx = WS2812FX(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
Serial.begin(115200);
ws2812fx.init();
ws2812fx.setBrightness(255);
pinMode(button_A, INPUT); // declare LED as output
pinMode(button_B, INPUT); // declare pushbutton as input
ws2812fx.start();
}
void loop() {
val_A = digitalRead(button_A); // read input value
val_B = digitalRead(button_B); // read input value
Serial.println(val_A);
Serial.println(val_B);
ws2812fx.service();
if ( val_A == HIGH && val_B == LOW )
{
ws2812fx.setSegment(0, 0, 3, 4, 0xfffb00, 1300, true); // segment 0 is leds 0 - 9
ws2812fx.setSegment(1, 4, 8, 28, 0xffffff, 80, true);
}
else if ( val_A == LOW && val_B == HIGH )
{
ws2812fx.setSegment(0, 0, 3, 28, 0xffffff, 80, true);
ws2812fx.setSegment(1, 4, 8, 4, 0xfffb00,1300, false);
}
else
{
ws2812fx.setSegment(0, 0, 3, 28, 0xffffff, 80); // segment 0 is leds 0 - 9
ws2812fx.setSegment(1, 4, 8, 28, 0xffffff,80);
}
}
Documention for setSegment():
setSegment(segment index, start LED, stop LED, mode, colors[], speed, reverse);
Looks like you are uing Mode 4 (Color Wipe Inverse) and Mode 28 (Multi Strobe). Is it not working the way you expect?
im expected 2 segment same blinking and light sync after buttton released. i have been test using reset , remove , add , start and stop its no one working with my code
for example when no button pressed 2 segment light its same.
but after pressed 2 segment become not same and different light not sync
Call ws2812fx.start();
when you want to re-synchronize the two segments.
system
Closed
November 3, 2022, 1:02pm
7
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.