# Need HELP for a Arduino Menu code

**URL:** <https://forum.arduino.cc/t/need-help-for-a-arduino-menu-code/1246088>\
**Category:** Product Design\
**Created:** [April 10, 2024, 10:34am UTC](https://forum.arduino.cc/t/need-help-for-a-arduino-menu-code/1246088 "2024-04-10T10:34:59Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![J-M-L](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/j-m-l/32/766245_2.png) [@J-M-L](https://forum.arduino.cc/u/J-M-L)\
**Post date:** [April 10, 2024, 11:38am UTC](https://forum.arduino.cc/t/need-help-for-a-arduino-menu-code/1246088/4 "2024-04-10T11:38:01Z")

</div>

it means "_terminate the program_" (ie nothing works after that) so very different than break 🙂

you might benefit from studying state machines. Here is a small introduction to the topic: [Yet another Finite State Machine introduction](https://forum.arduino.cc/t/yet-another-finite-state-machine-introduction/1198997) and using a button library to handle bouncing etc. it will make your code much easier

* * *

another weird stuff is

> [@taporoc](#):
>
> ```arduino
> void setup() 
> {
> if (hasRun == false) 
> 
> ```

the setup runs only once, and you set `hasRun` to false so this variable is useless

* * *

it's also usually a good idea to keep things that are related in a struct . You could do something like this

```arduino
struct Student {
  const char * studentName;
  byte uid[4];
};

Student students[] = {
  { "abc", {0xB9, 0x1C, 0x0B, 0xD6}},
  { "def", {0x33, 0x07, 0x4C, 0xD1}},
  { "ghi", {0x20, 0xD3, 0xA7, 0x88}},
  { "jkl", {0x96, 0xF7, 0x58, 0x9E}},
  { "mno", {0x23, 0x66, 0xA6, 0xD0}},
  { "pqr", {0x95, 0xBB, 0x09, 0x43}},
  { "stu", {0x59, 0x48, 0x0D, 0xC9}},
};
const byte studentCount = sizeof students / sizeof *students;

```

* * *

when you do menu-- or menu++ you should check that you stay within the bounds of the defined menu

---

_[View the full topic](https://forum.arduino.cc/t/need-help-for-a-arduino-menu-code/1246088)._
