Go Down

Topic: Ironman project (Read 841 times) previous topic - next topic

andrewmoulton4

So as a newcomer to arduino I've set myself a high bar, my ultimate aim is to create a menu system that selects a script to run a function. Managed already to make the faceplate open and close and lights to come on, also wrote a script for an arm opening containing missiles +non firing) and LEDs. Started looking at the menu system and I'm lost, like waaaaay out of my depth. As far as i can figure the simplest way would be to use a two button system, one to scroll and one to select, I'm looking at 7 individual actions of which 5 will have a further command alongside it, plus i want a menu command that will cycle through all the commands individually. All the components will have e their own power supply wired in, I'm using phone battery's to power servos and LEDs and an electric valve for co2. What I'm asking is this, is it even possible to run this many commands off an uno,  and if not what are my options? Also, where's a good place to start with the menu, do i write individual scripts for each action and then paste that into a menu option? Or do i have to write it all at once? Any one fancy helping?

patduino

#1
Apr 02, 2017, 05:31 pm Last Edit: Apr 02, 2017, 05:32 pm by patduino
Hi Andrew,

You might want to start thinking about how you can break the armor functions into smaller, more manageable groupings and estimate the resource utilization requirement for each.  This might involve some simple prototyping and extrapolation.  You'll likely find that you need to break the total function set into smaller individual subsystems (i.e., different Arduinos) and develop those independently (mask / armor, missile control, etc.) and control them via TTL or I2C commands.

There are a number of menu libraries out there, but most have been developed for a specific use and may be unusable for you.


An "Uno" probably won't have enough RAM for what you want, so you might want to look into using a "Mega" version.

Pat.
There are 10 types of people in the world, those who understand binary, and those that don't.

PaulMurrayCbr

I'm looking at 7 individual actions of which 5 will have a further command alongside it, plus i want a menu command that will cycle through all the commands individually.

What I'm asking is this, is it even possible to run this many commands off an uno,
Yes. of course

Quote
Also, where's a good place to start with the menu, do i write individual scripts for each action and then paste that into a menu option? Or do i have to write it all at once? Any one fancy helping?
Four buttons arranges as left/right up/down pad is a natural way to deal with menus. up/down to scroll, right/left to select/exit.

As for algorithm, I'd tend to have an array of structs. You can do the equivalent with several matching arrays, but structs are neater.

Code: [Select]

struct MenuItem {
  int indentLevel;
  boolean isOpen;
  void (*onSelected)(MenuItem &item);
};


The onSelected item is a "pointer to function", initialized to point at the actual working function to be executedn when the menu item is activated. You have an array of these items and a number for "current menu" and "current scroll location", and functions to draw the menu on your output device given its current state.

The up/down/select/back buttons then move around the menu by manipulating the variables and redrawing the menu.

It's … not a simple job, to tell you the truth.



http://paulmurraycbr.github.io/ArduinoTheOOWay.html

Go Up