Driver for Diving Flashlite

i think the hall doesn´t need a external resistor. it Needs 5 Volt at the Input and give a low on Output. when the magnet is near the Output will Switch from low to high.

    if (ledPinwhite == 0 && ledPinblue == 0)

my idea was to use the if cause i must inluce the hall and the state of the leds. so if the hall give a high and both leds are of then the light have to Switch to the first mode. but you are right the leds are set to low in Initial state! so this seem better for me:

  if (reading == HIGH && previous == LOW && millis() - time > debounce) {
    {
      analogWrite(ledPinwhite,64);
    }
    if (ledPinwhite == 64 && ledPinblue == 0)
    {
      analogWrite(ledPinwhite,128);
    }
    if (ledPinwhite == 128 && ledPinblue == 0)
    {
      analogWrite(ledPinwhite,254);
    }
    if (ledPinwhite == 254 && ledPinblue == 0)
    {
      analogWrite(ledPinwhite,0);
      analogWrite(ledPinblue,255);
    }
    if (ledPinwhite == 0 && ledPinblue == 255)
    {
      analogWrite(ledPinblue,0);
    }

markus