Go Down

Topic: Beginners: Array of predefined patterns to pins mapping - 3 different approaches (Read 386 times) previous topic - next topic

massam

Aug 03, 2019, 01:39 am Last Edit: Aug 03, 2019, 03:22 pm by massam Reason: Added Beginners: to subject
Hi all,

In this demonstration, I'd like to show 3 different approaches towards mapping a predefined array of patterns or states of HIGH or LOW to an array of Yellow colored LEDs, with the selected pattern shown with Blue colored LEDs.

At the top of the code, by default, the AUTORUN is enabled to keep the patterns on auto cycling.
Please disable it as per the comments within the code to then be able and apply the desired function to run and select the patterns manually with buttons to demonstrate the same result using the 3 methods.

The methods demonstrated are:

1- Per individual index as one by one manual index mapping of patterns to both blue and yellow leds
2- For Loop increments index mapping of patterns to both blue and yellow leds
3- PORT level mapping using DDR and PORTx with binary codes mapping to PORTx

Board used is Arduino mega 2560.

Here is an animated preview.

Source code and pins connections diagram attached below.

Go Up