Add Sound to your Program

There is a round piezospeaker built into the SumoBot WX board, right in front of the Propeller FLiP socket. It is connected to Propeller I/O pin P20.  You can make the speaker beep by using the Audio category's frequency out block. Let's update the program to beep the piezospeaker, and print two messages.

If there is a sticker on the speaker, you can remove it now!

  • Watch the animation below to modify your program, with these steps.
    • Right-click the Terminal print text block, and choose Duplicate.
    • Update the message in the top block to "Speaker test..."
    • Update the message in the bottom block to "Did you hear a beep?"
    • Click the Audio category and place a Frequency out block in the canvas, between the Terminal print text blocks.
    • In the Frequency out block, set the PIN to 20, set duration (ms) to 1000 and set frequency (Hz) to 3000.
    • Click and drag the blocks until they snap together.
    • Click on the project title and re-name it SumoBot Speaker Test.
    • Save the modified program.

This time, you will save your program in the Propeller FLiP EEPROM (Electrically Erasable Read Only Memory). 

  • Click Load and run (save code to EEPROM). You should hear a beep, and see both messages in the Terminal.

 

  • Now, unplug the USB cable from the FLiP module, and press the RST button on the SumoBot WX board to reset the Propeller chip.

Did you hear the beep again?  The code is now stored in the FLiP module and it will run every time you press the reset button.