This block will run 2 coding strips at the same time.
LEGO® Powered UP App coding example: Use a switch to run 2 instructions at the same time
Step 1: Add coding blocks
- Flow block – Start on condition change
- Widget block – Toggle widget, select address 0
- Flow block – Run instructions in parallel
- Sound and light block – Play from the whistle sound library
- Sound and light block – Play from the laser sound library
Step 2: Add Canvas Toggle Button with address 0
Step 3:
- Navigate to the Application control view
- Observe that when the program starts, no sound is played
- Press the Canvas Toggle Button (Toggle widget output value now is true)
- Observe that after pressing the Canvas Toggle Button sounds from the whistle sound library and laser sound library are played
- Press the Canvas Toggle Button (Toggle widget output value now is false)
- Observe no sound is played