UltraViolet Posted June 25, 2022 Posted June 25, 2022 As this topic relates to a project that will be on rails, I figured I would ask the question here. I am attempting to script a seemingly basic function on the PFx Brick, but can't for the life of me understand why it doesn't work. The scenario involves two LEDs - one is green and gets turned on immediately at power up (via a separate startup action), and the other is red. The action I'm trying to script is when a remote control button (or joystick) is pressed and held, that action runs a script that turns off the green LED and turns on the red LED. When the button is released, another script reverses the LEDs so green is again on and red is again off. The script code for when the button is pressed is as follows: light 1 off light 2 on The script code for when the button is released is as follows: light 1 on light 2 off The first line of each script file will work properly, so one light turns on and off as expected. The second lines, however, never do anything, and the order of the two lines makes no difference. I noted in the documentation that in the case of "event" commands, multiple actions may be triggered, but each type of action can only be called once inside the statement. While I'm not using "event" commands, is this still why multiple "light" commands get ignored? This shouldn't be the case according to the limited script code examples I've seen. I've also noted that the script files are only recognized as scripts by the PFx application if they have a ".txt" file extension, which is at odds with the documentation that says the extension should be ".pfx". If I have to make this work in a one line command, the only thing I can think of is to cheat with the RGB color LED command, as that would affect multiple output pins simultaneously. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.