Need HELP for a Arduino Menu code

it means "terminate the program" (ie nothing works after that) so very different than break :slight_smile:

you might benefit from studying state machines. Here is a small introduction to the topic: Yet another Finite State Machine introduction and using a button library to handle bouncing etc. it will make your code much easier


another weird stuff is

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

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

1 Like