Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Arduino Menu and recursive menu

Status
Not open for further replies.

imranahmed

Advanced Member level 3
Advanced Member level 3
Joined
Dec 4, 2011
Messages
822
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Location
Karachi,Pakistan
Visit site
Activity points
6,533
Hi,

Using Arduino Mega2560, 16x2LCD, SD Card.

The project have 24 programs each program can store 50 audio mp3 (bells) files from SD card.

Programs are selected by push buttons up/down programs 01 to 24 , we go to menu choose program 01 to 24
if we select program 02 then go to next menu where we will select how many bells choose for program 02 for e.g. we will select three bells 01,02,03
by up/down button then go to next menu open bell 1 menu where we select file from SD card for e.g file-1, then go to next menu where we select file from SD card for e.g file-2
then go to next menu where we select file from SD card for e.g file-3 then next press will save settings and go to main menu

Please let me know how to do it I need hints and guidance.

Thanks
Imran
 

Flow charst are a great way to visually contruct what you need to do :

1649453588827.png



Regards, Dana.
 
Hello!

Your explanation is not clear enough to me. Why are you calling
your mp3 file "bells"? Is it a different bell sound for any of the 50 keys?
A kind of musical instrument? And you have 24 sets of 50 bells?

Could be a good idea to write a general description of what you want to do.

Dora.
 
For your project it seems there are 3 main things that you should plan ahead, else re-work effort will be very high.

1. Menu structure
Finalize the number of sub-levels of menu and number of buttons used to navigate through the menu. (Usually up, down, back, enter 4 keys are enough). Donot compromise on changing this structure after you have started coding. Divide the complete project into different stateMachines Eg. STANDBY_STATE, MENU_MAINMENU_STATE, MENU_SUBMENU_1_STATE, MENU_SUBMENU_1_SHOWLIST_STATE. For each state of your statemachine, decide what needs to be displayed and what pushButton keys must work. Code accordingly.

2. Timing
Run the Display function at around 250ms loop and run PushButton Polling in 10ms loop. It is evident that you need to de-bounce the push button press every-time. Running 2 loops helps you to achieve this easily and also you can add additional feature such as press and hold function for pushbutton to easily scroll-through the menu

3. Coding Tips
Use enums to define stateMachine. Use structures for defining variables at any application handlers. Always try to minimize the number of variables used in whole project, because when handling different menus, more variables leads to more confusion.
 
Thank you vishweshgm, doraemon and danadakk,

Summary is that I have to built school bell device which works as (please excuse my english is not good).
Where we can set 24 Programs each program contains 50 bells and setting of time(used RTC DS3231) when it will ring.
Program flow is main display showing time and date and Winter or Summer and selected program P01 to P24 any and alarm time.
when we will press enter button goes to Main Menu where we can set Date&Time, Program Schedule.
In Program Schedule we goes, displaying P-01 now we can select any program by up/down key P-02 or P-08.
Now we select P-04 then enter goes to next menu where we will select how many bells we select for P-04 using
up/down selecting bells 01 to 50 now select three bells for P-04 then enter goes to next menu now displaying settings for
bell 01 where we can set alarming time for bells 01 and file from SD card we choose file1 then enter goes to bell 02 where we can
set alarming time for bells 02 and file from SD card we choose file2 then enter goes to bell 03 where we can
set alarming time for bells 03 and file from SD card we choose file3 then enter goes to main display.

If we selected 5 bells then settings will be done for 5 bells so on..
 

Hi,

Generally a picture tells more than a lot of words.
...especially when you are concerned about English language.
--> use paper and pencil

Klaus
 
Please try to understand attached picture

Unreadable, you could have spent a little more enthusiasm and neat into crafting this diagram. Anyway, even if you are able understand it, what prevents you from proceeding to the next step? Translate the diagram to a draft program, in function blocks and state machine.
 

Unreadable, you could have spent a little more enthusiasm and neat into crafting this diagram. Anyway, even if you are able understand it, what prevents you from proceeding to the next step? Translate the diagram to a draft program, in function blocks and state machine.
I am only stuck in part of program where we goes to select Programs 01 to 24 then goes to next menu select total bells such as we select four bells then goes to next menu 1st bell menu opens now setting alarm time and file select then enter goes 2nd bell menu opens now setting alarm time and file select then enter goes 3rd bell menu opens now setting alarm time and file select then enter
 

Hello!

Your new explanation is still not understandable, at least for me. There are some words (bell, ring, summer time
etc) which lead me to think it is a kind of programmable clock. Is it so?
In this case, why don't you start with: I want to build a programmable clock with alarm?
And if it's not a programmable clock, then tell us what it is first.
You're also talking about "24 programs", on Arduino. Do you need a mechanism that allows you to change
programs on the fly (i.e. a kind of boot loader that would take programs out of the SD card, copy it to flash
and run it?

Dora.
 

Hello!

Your new explanation is still not understandable, at least for me. There are some words (bell, ring, summer time
etc) which lead me to think it is a kind of programmable clock. Is it so?
In this case, why don't you start with: I want to build a programmable clock with alarm?
And if it's not a programmable clock, then tell us what it is first.
You're also talking about "24 programs", on Arduino. Do you need a mechanism that allows you to change
programs on the fly (i.e. a kind of boot loader that would take programs out of the SD card, copy it to flash
and run it?

Dora.
Yes it is a programmable school bell with alarming system, there are different periods in school for different times.
A school bell should be looks like it has 24 programs, each program will be able to save 50 bells means we select program P-01
and in program P-01 we will save number of bells as we want from 1 to 50. If we want 4 bells in program P-01 and set it, then
In main program if we select program P-01 it has 4 bells alarming on 4 different times of periods. (bells will be select from SD card it is not a big issue)
but I am stuck when we goes to select bells in program P-01 or any to P-24.

Please visit this link I want to make this bell.
 

You got the tips already, what else needed ?
  • Draw the structure of your code in bloc diagram.
  • Consider implementing menu/submenu variables to define layers.
  • Use State Machine to define where user is currently browsing at.
Don't expect people doing this for you.
 

    KlausST

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top