My 3x3x3 and 5x5x5 LED cube

What I did was do the 1/27 duty cycle, alot of code but you can copy and paste so it becomes easier. You could also use for less code is lable a xyz not sure how to do that though.