Need Help With Police Light Modes
hello,
i having quite bit of trouble getting code work way like. volunteer firefighter, , refuse spend $200 on light bar, when can make 1 around $30. how works:
-turn on, set button state, , mode 0 "off"
-once button pressed, add 1 mode
-in mode 0, (the default), led's off
-in mode 1, led's flash pattern (supposed loop until push button)
-every time push button, mode changes
-in mode 2, led's flash different pattern
-in mode 3, mode reset 0, making led's stop flashing.
the problem when board in first mode, led's flash forever, , cannot change mode. need change mode can use different flash patterns. isn't working because of "while" statements used.
tl;dr want loop until push button. cannot figure out how. loops forever , won't change mode.
i cannot paste code window because exceeds maximum allowed length of post, attaching post may review @ pleasure.
i having quite bit of trouble getting code work way like. volunteer firefighter, , refuse spend $200 on light bar, when can make 1 around $30. how works:
-turn on, set button state, , mode 0 "off"
-once button pressed, add 1 mode
-in mode 0, (the default), led's off
-in mode 1, led's flash pattern (supposed loop until push button)
-every time push button, mode changes
-in mode 2, led's flash different pattern
-in mode 3, mode reset 0, making led's stop flashing.
the problem when board in first mode, led's flash forever, , cannot change mode. need change mode can use different flash patterns. isn't working because of "while" statements used.
tl;dr want loop until push button. cannot figure out how. loops forever , won't change mode.
i cannot paste code window because exceeds maximum allowed length of post, attaching post may review @ pleasure.
all calls delay() enemy. learn flash leds without delay(). see blinkwithoutdelay example comes arduino ide. search forum, there literally hundred of posts blinkwithoutdelay.
i'd implement state machine, each button push advances next state. each flashing pattern implemented separate function.
i'd implement state machine, each button push advances next state. each flashing pattern implemented separate function.
Arduino Forum > Using Arduino > Programming Questions > Need Help With Police Light Modes
arduino
Comments
Post a Comment