Push button servo sweep programme help

"Now revise the code to put the data in arrays (or a struct) and iterate through it to avoid the duplicate code that reads the input, adjusts the angle and writes to the servo for each finger

If the code works as is, why do that? Just curious.

If the code works as is, why do that? Just curious.

A fair question and I should have explained why I suggested it.

It is an opportunity to learn how to use arrays/structs which could be useful in future projects as well as reducing code size which could also come in useful later. The advantage of improving a working program is that if it all goes wrong, you make no progress or simply run out of time you always have the working program to fall back on

"It is an opportunity to learn how to use arrays/structs which could be useful in future projects as well as reducing code size which could also come in useful later. The advantage of improving a working program is that if it all goes wrong, you make no progress or simply run out of time you always have the working program to fall back on"

That may be more like homework or busy work than a functional "improvement". Making code more nested and looping/recursive is something to do, but it may make it more taxing to visually track the logic flow when troubleshooting or making changes. There may or may not be programming space saved after the compiler gets done, but that would be addressing another issue. Just saying.