The TXT 4.0 Controller: has a built-in speaker, and therefore offers the option of playing sounds.
The Start each time block
The Start each time block offers the option of running a program when a condition is fulfilled. Therefore, it works similar to a case distinction, but runs not only one time, but rather every time the condition is fulfilled during the entire course of the program. The Start each time block:
Is an abbreviation for the following construct:
You can insert all conditions from this category into the sound category in the Start each time block.
Note: The program section in the Start each time block should be kept short, and should not contain any blocking calls or endless loops, so that this part of the program can be processed quickly.
Pre-installed audio files
You can use the following block to play one of 29 pre-installed sounds. You can select the desired audio using the drop down menu (small triangle). In addition, the sound can be played in a continuous loop. To do so, check the box beside the continuous loop symbol.
Own audio files
If you would like to play your own sound, you can use the block
To embed your own sound in the block, you must:
- be connected to the Controller
- enter the IP address of the Controller in the browser (you must select the IP that was used to connect to the Controller)
- enter USER: ft, PASSWORD: fischertechnik on the accessed page
- open the Sounds folder, and load the desired audio file to the Controller there using the plus sign (important note: the audio file must be available in wav format)
- enter “./filename.wav” in the ROBO Pro Coding block under path
Here as well, you have the option of playing the sound in a continuous loop.
To query whether an audio file is played, use the play sound block. This can be used as a condition in the program.
To stop a sound, simply use the stop playing sound block in the program.