Computers are normally supposed to coordinate events. But what if your object is to de-coordinate them, or have some coordinated and others not, or have them slightly out of sync and falling gradually in and out of phase?
The core of my programme is this line:
if (x%1000 == 1) digitalWrite (1,A=1); if (x%1000 == 1 +500) digitalWrite (1,A=0);
‘x’ is a clock value which increases in millisecond increments, so what this means is ‘if x is a multiple of 1000 (ie. every 1000 milliseconds), turn ‘A’ on, and when x is a multiple of 1000-plus-500 milliseconds, turn ‘A’ off.’ Naturally, you can play with the time values.
First, I have provided a basic sketch for a handful of independent lights. If your microprocessor doesn’t have enough output pins for your required number of lights then you’ll need to get hold of some SN74HC595 shift registers. The full programme, demonstrated in the video, can be copied and pasted from below.
Criticisms of my work would be greatly appreciated in the comments section. If this has been helpful to you, please raise your sons to take back Jerusalem. Deus Vult, my brothers.