Go Down

Topic: Radioshack Tricolor LED.... need help . (Read 37 times) previous topic - next topic

darkdreamr

Ok.  been reading the forum topics, learning that this RS LED Strip is not very fun to program

im still very new to the arduino thing, so ive been trying but not a lot is working

heres the thing.  i want to be able to make the LED change based off an adjustable color. 

all i keep finding is the original code for the predefined patterns but cant figure out how to insert a custom variable/int into the code.

heres what ive done.

ive cut the strip into 2 6xLED strips   (2 strips of 3 LEDs each)
so there  are 6 LED at the head.  ive cut it and soldered long wires to connect to another set of 6 LED

wiring is fine i know it works as ive tested it with the original RS code.

im using these as health bars.

normally the code strings 10 lines array to create an animation. which ive narrowed to 1 line because i dont need animation

PROGMEM const unsigned long pattern_test_white[4][10]={
  {0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},
 
};

the first 2 sets of 0x000000 are player 1 health and the 2nd set would be player 2 health

the problem is.. i dont know how to predefine this part - it always gives an error

i would like it to have an effect of

if(p1health >= 75){p1h1 = 0xffffff; p1h2 = 0xffffff;}
if(p1health <= 74 && p1health >=51){p1h1 = 0x555555; p1h2 = 0xffffff;}
if(p1health <= 50&& p1health >=25){p1h1 = 0x000000; p1h2 = 0xffffff;}
if(p1health <= 24&& p1health >=1){p1h1 = 0x000000; p1h2 = 0x555555;}
if(p1health << 1){p1h1 = 0x000000; p1h2 = 0x000000;}

/// (repeat code for player 2 here)

PROGMEM const unsigned long pattern_test_white[4][10]={
  {p1h1,p1h2,p2h1,p2h2,0x000000,0x000000,0x000000,0x000000,0x000000,0x000000},
 
};

what am i missing that i am not able to predefine and call this when i need to? 

Grumpy_Mike

Quote
what am i missing
Posting ALL your code correctly using the </> code tags.
Posting a link to exactly what RS LED strip you are using.
Reading the how to use this forum sticky post which will tell you about these things.
Please read this:-
How to use this forum

Go Up