The Quorum Studio Coding window for this lesson appear here with the lines of code and comments. Look for links named Full Code as Text with Comments to get the same information in text.

Sound10: This lesson will let you make use of the built-in sound with the EV3 robot. You will again use the if/elseif statements to tell the button what sound you want to make. As a bonus at the end after you press the escape key it will play all of the built-in sound again for you to hear. You will also learn how to display a integer variable on the screen. We are setting the volume to 50 (50%), 0 is off and 100 is the loudest.

Click here to see the code without comments to copy &paste. ==>
//just the code no comments
use Libraries.Robots.Lego.Button
use Libraries.Robots.Lego.Sounduse Libraries.Robots.Lego.ScreenButton buttonSound soundScreen screeninteger volume = 50screen:OutputCenter("Built In Sounds", 1)screen:OutputCenterLarge("Volume", 2)screen:OutputCenterLarge("V=" + volume, 4)sound:Beep()button:SetLightPattern(3)repeat until button:IsButtonPressed(button:ESCAPE_BUTTON) if button:IsButtonPressed(button:LEFT_BUTTON) sound:Beep() elseif button:IsButtonPressed(button:RIGHT_BUTTON) sound:Buzz() elseif button:IsButtonPressed(button:UP_BUTTON) sound:BeepSequenceUp() elseif button:IsButtonPressed(button:DOWN_BUTTON) sound:BeepSequenceDown() elseif button:IsButtonPressed(button:CENTER_BUTTON) sound:BeepTwice() endendsound:Buzz()sound:Beep()sound:BeepSequenceUp()sound:BeepSequenceDown()sound:BeepTwice()
Sample Video appears to the right.Scroll down to see student summited videos


Student Videos

GITHUB BUTTON HERE