Two scripts won’t run together. How do you fix this? Solved

I have two LUA scripts.
The first script starts and stops video recording using a Seagull #REC connected to AUX 3. It is controlled using a Herelink.
It uses the method
‘servo.set_output (function_number, PWM) ‘

The second script simply sets one colour on 7 WS2812 LEDs connected to AUX 2.
It uses the methods
set_num_LEDs( output_number , number_of_LEDs )
set_RGB( output_number , LED_number , r , g , b )
send()

Both scripts are quite simple and are attached.

Individually they both work.
But If I load both scripts only the LED script works, so somehow the LED script disables the Seagull script.

If anyone can help fixing this, it would be appreciated!!

Seagull Ch1 REC Only Ver 01 Forum.lua (3.1 KB)
All LEDs to one colour Simple.lua (688 Bytes)

Do you have enough memory allocated under SCR_HEAP_SIZE?

1 Like

I’ve been using 150000. Which works with larger scripts?
The scripts are working as they are sending messages to the Herelink.

Yeah, that’s almost certainly not the problem.

I noticed some anomalies with the Cube Orange and LED scripting a few months ago and never got around to fully testing, but I noticed that sometimes my own LED script would work and sometimes it wouldn’t. It seemed to help to add a 750ms delay to the LED script before executing any LED commands after initial boot.

1 Like

When I connect the SBUSo to a tester I can see the Video channel PWM change but when I connect I connect the AUX Video channel there is nothing. It almost seems as if the LED script disables the AUX channel?

@WickedShell
Hi. Is there any chance of looking at this as there seems to be some conflict between the LED methods and this servo method? ‘servo.set_output (function_number, PWM) .
The LED scripts block the servo scripts?
Peter

1 Like

Your running into the PWM groups, move one or other on to aux 5 or 6.

The PWM groups for CubeOrange are aux 1-4 and aux 5 and 6. You can only do one type of PWM in each group. LEDs is one type and servo pwm another hence the conflict.

1 Like

@iampete
Hi Peter
That works perfectly and thank you for your help!

1 Like