Arduino Void Loop Question

Hey, So im making an LED matrix and multiplexing must be a part of it. I wrote some code that got the rows to switch. But now i want to know how i can sort of name it and late in the code when i want to tell it the same function, i will only have to write down something small instead of that full code. This is because im going to make 2 buttons swap between the different light patterns i make. I may ask for help when i get to that part as well. Thank you, here is my code

PS> im very new to coding

LED_matrix_code.ino (2.34 KB)

The function you're looking for is as below: (make sure its pasted outside of the setup{} and loop{}).

void lightFunction1(void){

When you want to call that function paste this in your loop{}:


The first void tells the function that it doesn't have to return with anything after completing the function, the second void after the made up name lightFunction1 (Could be anything you want as long as it matches the name in the loop.) means that you're not trying to bring any variables into the function to do work on.

Thanks a million!