I am working with some APA102 LEDs. One of the variable functions is the brightness.
To get the correct set of bit to send to the LEDs a number between 0 and 31 is or with %11100000
it did dawn on me that instead of having this before calling the send macro, I could add this to the macro itself
is there any known reason why this wont work, it compiles but I can't test until a few days time and I am wondering if anyone can shed any light on it
I did try:
and get a syntax error despite being basically the same
Also is it possible to pass number out as well? so if I pass BXX into n1, add or subtract one, then pass it back out to BXX. BXX is going to be at least 3 different variables, maybe 4
To get the correct set of bit to send to the LEDs a number between 0 and 31 is or with %11100000
Code:
alter_bright = brightness | %11100000
is there any known reason why this wont work, it compiles but I can't test until a few days time and I am wondering if anyone can shed any light on it
Code:
[color=Navy]#macro [/color][color=Black]sendPacket[/color][color=Blue]( [/color][color=Black]n1, n2, n3, n4 [/color][color=Blue])
[/color][color=Purple]sendbyte [/color][color=DarkCyan]= [/color][color=Black]n1 | [/color][color=Navy]%11100000 [/color][color=Black]: [/color][color=Blue]gosub [/color][color=Black]send_byte
[/color][color=Purple]sendbyte [/color][color=DarkCyan]= [/color][color=Black]n2 : [/color][color=Blue]gosub [/color][color=Black]send_byte
[/color][color=Purple]sendbyte [/color][color=DarkCyan]= [/color][color=Black]n3 : [/color][color=Blue]gosub [/color][color=Black]send_byte
[/color][color=Purple]sendbyte [/color][color=DarkCyan]= [/color][color=Black]n4 : [/color][color=Blue]gosub [/color][color=Black]send_byte[/color]
[color=Navy]#endmacro[/color]
Code:
[color=Navy]#macro [/color][color=Black]sendPacket[/color][color=Blue]( [/color][color=Black]n1, n2, n3, n4 [/color][color=Blue])
[/color][color=Black]n1 [/color][color=DarkCyan]= [/color][color=Black]n1 | [/color][color=Navy]%11100000
[/color][color=Purple]sendbyte [/color][color=DarkCyan]= [/color][color=Black]n1 : [/color][color=Blue]gosub [/color][color=Black]send_byte
[/color][color=Purple]sendbyte [/color][color=DarkCyan]= [/color][color=Black]n2 : [/color][color=Blue]gosub [/color][color=Black]send_byte
[/color][color=Purple]sendbyte [/color][color=DarkCyan]= [/color][color=Black]n3 : [/color][color=Blue]gosub [/color][color=Black]send_byte
[/color][color=Purple]sendbyte [/color][color=DarkCyan]= [/color][color=Black]n4 : [/color][color=Blue]gosub [/color][color=Black]send_byte[/color]
[color=Navy]#endmacro[/color]
Also is it possible to pass number out as well? so if I pass BXX into n1, add or subtract one, then pass it back out to BXX. BXX is going to be at least 3 different variables, maybe 4