Go Down

Topic: Circular menus class (Read 4575 times) previous topic - next topic


Sep 22, 2011, 02:36 pm Last Edit: Sep 22, 2011, 02:41 pm by kitsaros Reason: 1
Hello !
I just made a circular menu class and i want to share it with you.
The class supports unlimited menu elements with unlimited levels.

The full documentation can be found here :

In the demo example i create this menu :
Code: [Select]

Menu 1 [0]                                         (f:0,d:1,r:0)
Menu 2 [1]                                         (f:1,d:6,r:2)
   Menu 2>Smenu 1  [2]                            (f:1,d:3,r:2)
   Menu 2>Smenu 2  [3]                            (f:1,d:4,r:3)
   Menu 2>Smenu 3  [4]                            (f:1,d:5,r:4)
   Menu 2>up one dir [5]                          (f:1,d:2,r:5)
Menu 3 [6]                                         (f:6,d:14,r:7)
   Menu 3>Smenu 1 [7]                             (f:6,d:8,r:7)
   Menu 3>Smenu 2 [8]                             (f:6,d:12,r:9)
       Menu 3>Smenu 2>SSmenu 1 [9]                (f:8,d:10,r:9)
       Menu 3>Smenu 2>SSmenu 2 [10]               (f:8,d:11,r:10)
       Menu 3>Smenu 2>up one dir [11]             (f:8,d:9,r:11)
   Menu 3>Smenu 3 [12]                            (f:6,d:13,r:12)
   Menu 3>up one dir [13]                         (f:6,d:7,r:13)
Menu 4 [14]                                        (f:14,d:0,r:15)
   Menu 4>Smenu 1 [15]                            (f:14,d:21,r:16)
       Menu 4>Smenu 1>SSmenu 1 [16]               (f:15,d:20,r:17)
           Menu 4>Smenu 1>SSmenu 1>SSSmenu 1 [17] (f:16,d:18,r:17)
           Menu 4>Smenu 1>SSmenu 1>SSSmenu 2 [18] (f:16,d:19,r:18)
           Menu 4>Smenu 1>SSmenu 1>up one dir [19](f:16,d:17,r:19)
       Menu 4>Smenu 1>up one dir [20]             (f:15,d:16,r:20)
   Menu 4>Smenu 2 [21]                            (f:14,d:22,r:21)
   Menu 4>Smenu 3 [22]                            (f:14,d:23,r:22)
   Menu 4>Smenu 4 [23]                            (f:14,d:24,r:23)
   Menu 4>Smenu 5 [24]                            (f:14,d:25,r:24)
   Menu 4>up one dir [25]                         (f:14,d:15,r:25)

The menu definition can be defined like this :
Code: [Select]

 //Menu definition (Title,Father,Down,Next)
 (*(MyMenu.GetMenuCell(0))).Set("Menu 1", MyMenu.GetMenuCell(0), MyMenu.GetMenuCell(1),MyMenu.GetMenuCell(0));
 (*(MyMenu.GetMenuCell(1))).Set("Menu 2", MyMenu.GetMenuCell(1), MyMenu.GetMenuCell(6),MyMenu.GetMenuCell(2));
 (*(MyMenu.GetMenuCell(2))).Set("Menu 2>Smenu 1", MyMenu.GetMenuCell(1), MyMenu.GetMenuCell(3),MyMenu.GetMenuCell(2));
 (*(MyMenu.GetMenuCell(3))).Set("Menu 2>Smenu 2", MyMenu.GetMenuCell(1), MyMenu.GetMenuCell(4),MyMenu.GetMenuCell(3));
 (*(MyMenu.GetMenuCell(4))).Set("Menu 2>Smenu 3", MyMenu.GetMenuCell(1), MyMenu.GetMenuCell(5),MyMenu.GetMenuCell(4));
 (*(MyMenu.GetMenuCell(5))).Set("Menu 2>up one dir", MyMenu.GetMenuCell(1), MyMenu.GetMenuCell(2),MyMenu.GetMenuCell(5));
 (*(MyMenu.GetMenuCell(6))).Set("Menu 3", MyMenu.GetMenuCell(6), MyMenu.GetMenuCell(14),MyMenu.GetMenuCell(7));
 (*(MyMenu.GetMenuCell(7))).Set("Menu 3>Smenu 1", MyMenu.GetMenuCell(6), MyMenu.GetMenuCell(8),MyMenu.GetMenuCell(7));
 (*(MyMenu.GetMenuCell(8))).Set("Menu 3>Smenu 2", MyMenu.GetMenuCell(6), MyMenu.GetMenuCell(12),MyMenu.GetMenuCell(9));
 (*(MyMenu.GetMenuCell(9))).Set("Menu 3>Smenu 2>SSmenu 1", MyMenu.GetMenuCell(8), MyMenu.GetMenuCell(10),MyMenu.GetMenuCell(9));
 (*(MyMenu.GetMenuCell(10))).Set("Menu 3>Smenu 2>SSmenu 2", MyMenu.GetMenuCell(8), MyMenu.GetMenuCell(11),MyMenu.GetMenuCell(10));
 (*(MyMenu.GetMenuCell(11))).Set("Menu 3>Smenu 2>up one dir", MyMenu.GetMenuCell(8), MyMenu.GetMenuCell(9),MyMenu.GetMenuCell(11));
 (*(MyMenu.GetMenuCell(12))).Set("Menu 3>Smenu 3", MyMenu.GetMenuCell(6), MyMenu.GetMenuCell(13),MyMenu.GetMenuCell(12));
 (*(MyMenu.GetMenuCell(13))).Set("Menu 3>up one dir", MyMenu.GetMenuCell(6), MyMenu.GetMenuCell(7),MyMenu.GetMenuCell(13));
 (*(MyMenu.GetMenuCell(14))).Set("Menu 4", MyMenu.GetMenuCell(14), MyMenu.GetMenuCell(0),MyMenu.GetMenuCell(15));
 (*(MyMenu.GetMenuCell(15))).Set("Menu 4>Smenu 1", MyMenu.GetMenuCell(14), MyMenu.GetMenuCell(21),MyMenu.GetMenuCell(16));
 (*(MyMenu.GetMenuCell(16))).Set("Menu 4>Smenu 1>SSmenu 1", MyMenu.GetMenuCell(15), MyMenu.GetMenuCell(20),MyMenu.GetMenuCell(17));
 (*(MyMenu.GetMenuCell(17))).Set("Menu 4>Smenu 1>SSmenu 1>SSSmenu 1" , MyMenu.GetMenuCell(16), MyMenu.GetMenuCell(18),MyMenu.GetMenuCell(17));
 (*(MyMenu.GetMenuCell(18))).Set("Menu 4>Smenu 1>SSmenu 1>SSSmenu 2", MyMenu.GetMenuCell(16), MyMenu.GetMenuCell(19),MyMenu.GetMenuCell(18));
 (*(MyMenu.GetMenuCell(19))).Set("Menu 4>Smenu 1>SSmenu 1>up one dir", MyMenu.GetMenuCell(16), MyMenu.GetMenuCell(17),MyMenu.GetMenuCell(19));
 (*(MyMenu.GetMenuCell(20))).Set("Menu 4>Smenu 1>up one dir", MyMenu.GetMenuCell(15), MyMenu.GetMenuCell(16),MyMenu.GetMenuCell(20));
 (*(MyMenu.GetMenuCell(21))).Set("Menu 4>Smenu 2", MyMenu.GetMenuCell(14), MyMenu.GetMenuCell(22),MyMenu.GetMenuCell(21));
 (*(MyMenu.GetMenuCell(22))).Set("Menu 4>Smenu 3", MyMenu.GetMenuCell(14), MyMenu.GetMenuCell(23),MyMenu.GetMenuCell(22));
 (*(MyMenu.GetMenuCell(23))).Set("Menu 4>Smenu 4", MyMenu.GetMenuCell(14), MyMenu.GetMenuCell(24),MyMenu.GetMenuCell(23));
 (*(MyMenu.GetMenuCell(24))).Set("Menu 4>Smenu 5", MyMenu.GetMenuCell(14), MyMenu.GetMenuCell(25),MyMenu.GetMenuCell(24));
 (*(MyMenu.GetMenuCell(25))).Set("Menu 4>up one dir", MyMenu.GetMenuCell(14), MyMenu.GetMenuCell(15),MyMenu.GetMenuCell(25));

Let me know what do you think !


Thank you for such a nice menu..It will be helpful if you further explain it for us or do a small documentation if possible..Again my thanks to you for such great efforts and sharing with rest of us..
Simply...You can't afford me..

Author Of:

Oops..some one gave me Karma...:)


Sorry for the above post..you have documented it very well.. I am using one-wire Keypad(12 buttons) controlled with one Analogue pin only. Any chance of using it with your menu?..Another question is can you add example of blinking or anything done when clicking a certain menu?..In any menu item if i want to change the value can i do it?
Simply...You can't afford me..

Author Of:

Oops..some one gave me Karma...:)


Problems w/ Arduino 1.0

Working with the Advanced example.  Copied most of it and changed to work with Visual Studio + Arduino 1.0

While it compiles, when uploaded to my board, all I get is a cursor on 0,0 of my LCD.  I commented everything out and my system seems to stop at this first line in the setup():

(*(MyMenu.GetMenuCell(0))).Set("Menu 1", MyMenu.GetMenuCell(0), MyMenu.GetMenuCell(1),MyMenu.GetMenuCell(0));

I also had to update the header files for:

//#include "WProgram.h"
#include "Arduino.h"

Any thoughts?  Have you been able to get this to work with Arduino 1.0?


Apr 30, 2012, 01:53 am Last Edit: Apr 30, 2012, 01:55 am by kitsaros Reason: 1
The solution that you made "fixes" the class.
We have updated the class in this article :
To me seems that you have an implementation problem that has nothing to do with the circular class  :(
Anyway the new class can be downloaded from the link given above and works fine with Arduino 1.0 Gui version
A demonstration video is also included

Go Up