This works
post_frame(2,3);
This doesn't
post_frame(SDI_TAIL,CKI_TAIL);
is it possible to call a function using variables.
I have seen & used before the variables, is that a pointer to the vars?
Called function below.
void post_frame (int SDI, int CKI) {
//Each LED requires 24 bits of data
//MSB: R7, R6, R5..., G7, G6..., B7, B6... B0
//Once the 24 bits have been delivered, the IC immediately relays these bits to its neighbor
//Pulling the clock low for 500us or more causes the IC to post the data.
for(int LED_number = 0 ; LED_number < STRIP_LENGTH ; LED_number++) {
long this_led_color = strip_colors[LED_number]; //24 bits of color data
for(byte color_bit = 23 ; color_bit != 255 ; color_bit--) {
//Feed color bit 23 first (red data MSB)
digitalWrite(CKI, LOW); //Only change data when clock is low
long mask = 1L << color_bit;
//The 1'L' forces the 1 to start as a 32 bit number, otherwise it defaults to 16-bit.
if(this_led_color & mask)
digitalWrite(SDI, HIGH);
else
digitalWrite(SDI, LOW);
digitalWrite(CKI, HIGH); //Data is latched when clock goes high
}
}