> In C++ how do you assign a variable to a sequence of actions?

In C++ how do you assign a variable to a sequence of actions?

Posted at: 2014-12-18 
Create a function for each light:

blink1

blink2

blink3

blink4

All these do is cause the corresponding light to blink. Nothing else.

Then create a function that takes a list of integers (list..array...whatever you want to use) and calls the proper blink function.

Say you used an array. So if I send an array of [1, 2, 3, 4, 4, 3, 2, 1]:

blink_sequence(*light) {

for i = 0; i < len(light) - 1; i++ {

if i == 1 {blink1()}

else if i == 2 {blink2()}

else if i == 3 {blink3()}

else if i == 4 {blink4()}

else {# do some error thing}

}

}

It's been awhile since I've written in C or C++ but you get the idea.

Im wondering if its as easy as.....

a=u+w+y+z

and then printing a

(bad example but you get the gest I hope)

Im programming an arduino controller, and it uses C++.

I can make 4 LED pins blink in reverse order -no problem.

But how would I assign something where tha can be called upon later as one simple function rather than individually setting them off together.

So basically at times I want a 1,2,3,4 blink sequence, at others I want a 4,3,2,1 sequence.

Anyone know how to do this?