To begin, I am fairly solid with Arduino coding. However, I am just learning about CircuitPython, so please forgive me if I don't immediately understand an instruction or command in Python.
Looking at the code, there is a button set to SWITCH_PIN = board.D9 and from what I can tell, this is how to adjust the way the saber acts.
What I would like to add is another button to be able to change blade colors. In Arduino, I would use 4 sets of arrays to set my RGB color codes like this:
Code: Select all
int custColRed[5] = {255,0,0,100,255}
int custColGrn[5] = {0,255,0,0,20}
int custColBlu[5] = {0,0,255,255,147}
Code: Select all
color 0 (red) = color(custColRed[0], custColGrn[0], custColBlu[0])
color 1 (green) = color(custColRed[1], custColGrn[1], custColBlu[1])
color 2 (blue) = color(custColRed[2], custColGrn[2], custColBlu[2])
color 3 (purple) = color(custColRed[3], custColGrn[3], custColBlu[3])
color 4 (pink) = color(custColRed[4], custColGrn[4], custColBlu[4])
This is what I *think* I need to add:
Code: Select all
COLOR_PIN = board.D8
ccr = [255,0,0,100,255]
ccg = [0,255,0,0,20]
ccb = [0,0,255,255,147]