# Headlight/Flash Function Logic

**URL:** <https://community.ecumaster.com/t/headlight-flash-function-logic/567>\
**Category:** ADU\
**Created:** [January 7, 2024, 6:45am UTC](https://community.ecumaster.com/t/headlight-flash-function-logic/567 "2024-01-07T06:45:40Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![325racer](https://avatars.discourse-cdn.com/v4/letter/3/dc4da7/32.png) [@325racer](https://community.ecumaster.com/u/325racer)\
**Post date:** [January 7, 2024, 6:45am UTC](https://community.ecumaster.com/t/headlight-flash-function-logic/567/1 "2024-01-07T06:45:40Z")

</div>

I’m trying to setup my logic for headlights on a racecar. We are using the “Aux” output to trigger a relay (ran out of Outputs on the PMU).

I setup a Function that will turn on the headlights with a keypad button (we only have 1 headlight level, no secondary High beams). I also have second CAN button on the steering wheel that will trigger a Pulse to flash the lights.

So each function works independently, but I can’t get the logic to work to flash the lights when they are already ON.

I basically have the following.  
 ![image](https://europe1.discourse-cdn.com/flex013/uploads/ecumaster/original/1X/ca506f2e8f3c238dafdedba72e4ffe3667aa54c5.png)

I tried a few other configurations, but it would either not work at all, work only when BOTH buttons were active.

What I need is the following, just not sure which set of commands to make it happen.  
Lights on  
OR  
Pulse On/Off  
OR  
Lights on  
AND  
Pulse Off/On

Currently the Latching Lights on is overriding the Pulses.  
I have not changed the order with the pulse first, but I don’t think that would make a difference.

---

<div class="post-metadata">

**Author:** ![FloorItGarage](https://dub1.discourse-cdn.com/flex013/user_avatar/community.ecumaster.com/flooritgarage/32/61_2.png) [@FloorItGarage](https://community.ecumaster.com/u/FloorItGarage)\
**Post date:** [January 7, 2024, 8:07am UTC](https://community.ecumaster.com/t/headlight-flash-function-logic/567/2 "2024-01-07T08:07:43Z")

</div>

value=  
c\_steering\_button2  
AND  
not\_c\_steering\_button1 (false delay 6s)  
OR  
pulse c\_steering\_button1

You may need to use 2 functions and feed forward the first to the second if this is still causing the output to stay latched

---

<div class="post-metadata">

**Author:** ![325racer](https://avatars.discourse-cdn.com/v4/letter/3/dc4da7/32.png) [@325racer](https://community.ecumaster.com/u/325racer)\
**Post date:** [April 14, 2024, 6:44am UTC](https://community.ecumaster.com/t/headlight-flash-function-logic/567/3 "2024-04-14T06:44:09Z")

</div>

I finally got around to testing this and things seem a little closer. When the lights are off (k\_lights not set) things pulse as expected with a single push of Button 1. With lights on, they only pulse while Holding button1 (prior to adding the 6s false delay).

My question is, what is the 6s false delay intended to do?

![image](https://europe1.discourse-cdn.com/flex013/uploads/ecumaster/original/1X/4a6ef2fb85c76e8cc27023031f0417b01ab0c76c.png)

---

<div class="post-metadata">

**Author:** ![FloorItGarage](https://dub1.discourse-cdn.com/flex013/user_avatar/community.ecumaster.com/flooritgarage/32/61_2.png) [@FloorItGarage](https://community.ecumaster.com/u/FloorItGarage)\
**Post date:** [April 14, 2024, 10:36pm UTC](https://community.ecumaster.com/t/headlight-flash-function-logic/567/4 "2024-04-14T22:36:13Z")

</div>

I am a bit unclear if this works for you or not now. The function is a bit different then with your first post

My intent with the 6 second delay was to allow the pulse to complete. The function requires the light button to be on and the flash to pass not be pressed. If the FTP button is pressed it gives the pulse function 6 secons (3 pulses of 0.5 on and 0.5 off = 6s) to operate, which is on the other side of the OR. it being on the other side of the OR should let it operate with k\_lights off.

There’s a few ways to tackle this, but this way felt most efficient

---

<div class="post-metadata">

**Author:** ![325racer](https://avatars.discourse-cdn.com/v4/letter/3/dc4da7/32.png) [@325racer](https://community.ecumaster.com/u/325racer)\
**Post date:** [April 15, 2024, 3:02am UTC](https://community.ecumaster.com/t/headlight-flash-function-logic/567/5 "2024-04-15T03:02:16Z")

</div>

Sorry, unfortunately I don’t have the car at my house, so I work on things at home, then go to the shop and test.

At the moment, the FTP button works when k\_lights (headlights) is OFF. This is the pulse after the OR.

The next step is to allow the Pulse to work when k\_lights (headlights) is ON. This is the portion I’m still not getting to work correctly. Prior to adding the 6sec delay, what would occur is the lights would be on, but they would only Pulse while actively holding the FTP button, vs just pressing it and running the 3 pulse cycle.

---

<div class="post-metadata">

**Author:** ![razzor13bt](https://avatars.discourse-cdn.com/v4/letter/r/ecae2f/32.png) [@razzor13bt](https://community.ecumaster.com/u/razzor13bt)\
**Post date:** [April 15, 2024, 11:21am UTC](https://community.ecumaster.com/t/headlight-flash-function-logic/567/6 "2024-04-15T11:21:34Z")

</div>

Maybe an idea to use a nc/no relay and use it to switch between the two functions you need.

---

<div class="post-metadata">

**Author:** ![mkuklis\_ECUMASTER](https://dub1.discourse-cdn.com/flex013/user_avatar/community.ecumaster.com/mkuklis_ecumaster/32/104_2.png) [@mkuklis\_ECUMASTER](https://community.ecumaster.com/u/mkuklis_ECUMASTER)\
**Post date:** [April 15, 2024, 2:25pm UTC](https://community.ecumaster.com/t/headlight-flash-function-logic/567/7 "2024-04-15T14:25:07Z")

</div>

**Method 1:**  
More operations. More intuitive.

![light_pulse_method1](https://europe1.discourse-cdn.com/flex013/uploads/ecumaster/original/1X/6eaa02cbac77dc77f6658c2ddf36fb19720157a7.png)

**Method 2:**  
Optimized. Harder to understand without good knowledge of logic operations.

![light_pulse_method2](https://europe1.discourse-cdn.com/flex013/uploads/ecumaster/original/1X/fccd3e7ea631e44f424cd7dd21e7ca5327d00ab8.png)

---

<div class="post-metadata">

**Author:** ![325racer](https://avatars.discourse-cdn.com/v4/letter/3/dc4da7/32.png) [@325racer](https://community.ecumaster.com/u/325racer)\
**Post date:** [April 19, 2024, 4:18am UTC](https://community.ecumaster.com/t/headlight-flash-function-logic/567/8 "2024-04-19T04:18:26Z")

</div>

So in all my testing I could not seem to get any of this logic to work right.

When k\_lights was triggered, the lights would never pulse.

My question now is, does the order of commands create a priority?  
I have historically been putting k\_lights first, then pulse. So k\_lights on always seems to take priority. If I change the order will that make the Pulse the priority and override k\_lights?

---

<div class="post-metadata">

**Author:** ![mkuklis\_ECUMASTER](https://dub1.discourse-cdn.com/flex013/user_avatar/community.ecumaster.com/mkuklis_ecumaster/32/104_2.png) [@mkuklis\_ECUMASTER](https://community.ecumaster.com/u/mkuklis_ECUMASTER)\
**Post date:** [April 19, 2024, 10:28am UTC](https://community.ecumaster.com/t/headlight-flash-function-logic/567/9 "2024-04-19T10:28:57Z")

</div>

There is no priority.  
Operations from the project tree are executed from top to bottom, every cycle.

If my methods don’t work for you, that means you have the switches configured differently. I assumed “k\_lights” is a latching switch and “c\_steering\_button1” is a momentary switch.
