Lasse D Posted April 18, 2020 Posted April 18, 2020 I would like to cancel all audio streams in an action, but this unfortunately seems impossible with the basic setup. So I am looking into using scripts. Has anyone been able to make a script run in the app? The documentation doesn't say what the content of the script should be, and there are no sample files, other than the python file in the documentation. Using this sample file in the app results in no action - no motor change, no light and no sound. Edit: Found it: https://www.fxbricks.com/downloads/PFxBrickICD-Rev3.37.pdf EDIT 2. I have now been trying for a while to get this to work. Unfortunately there are some issues which prevent scripts from working. When trying to play sounds in a startup action, the script fails. However. It only fails when running the PFx brick from a battery box. When running from USB and connected to the app, everything works perfectly fine. Quote
Lasse D Posted May 20, 2020 Posted May 20, 2020 (edited) I do not have much luck in the PFx Brick forum, so I will try here. I currently have 3 unresolved problems when programming PFx bricks: 1) Beep sound when starting some sound files There are some sound files which cause a "beep" before being started from a script. These files do not cause a beep when started using a normal command, nor when the PFx brick is commanded using a USB cable. Here is an example that causes a beep: http://c-mt.dk/mocs/magnum/idle2.mp3 and here is one that does not: http://c-mt.dk/mocs/daf/daf_startup.mp. I would like to know what the cause of the beep is, so that I can prevent it. 2) Combining light toggle, sound toggle and motor direction toggle using standard setup I would like to combine toggling a light (reverse light) with a sound (reverse beep) and motor direction (to reverse). When I set this up on a channel (such as left reverse), then the reliability is poor: Sometimes the light toggle without the sound, and sometimes the sound toggles without the light. The motor changes direction only if the action is held for a while (around half a second). Is there a way to set this up more reliably? 3) Combining light toggle, sound toggle and motor direction toggle using a script Edit. The script below works. Just make sure to set motor speed using commands 0x02 (MOTOR_SPEED_INC non-bidirectional) afterward. I have created the following script for performing the 3 actions mentioned above. The light and sound toggling works reliably. Unfortunately the motor action for changing the direction (0x06) does not. Motor actions 0x00 and 0x01 (emergency stop and stop, respectively) work just fine - it is only the direction change that I can't get to work, even if I place the wait between stopping and reversing direction and so does the motor direction change (the documentation says that direction change only works when the motor is stopped) # Stop motor so direction can be toggled: motor 1 fx 0x01 0x00 0x00 #motor 1 fx 0x00 0x00 0x00 #wait 1 # Toggle reverse beeper: sound play "reve.wav" repeat # Change motor direction: motor 1 fx 0x06 0x00 0x00 # Toggle reverse light: light 2 fx 0x01 0x00 0x00 0x00 Any help with the first issue will be greatly appreciated. Issue 2 can be solved with the script from 3. Edited May 20, 2020 by Lasse D Found a solution to issue 3 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.