Home | pfodApps/pfodDevices | WebStringTemplates | Java/J2EE | Unix | Torches | Superannuation | | About Us
 

Forward Logo (image)      

Loud and Flashy pfodApp™
Android control of Arduino and other micros
No Android Programming Required

by Matthew Ford 9th June 2016 (originally posted 22nd February 2015)
© Forward Computing and Control Pty. Ltd. NSW Australia
All rights reserved.

How to add Sound and Flashy menus
to the Android interface
for your Arduino, or other micro, project



Introduction

pfodApp already supports big and bright menus to control your micro project and the free (and add free) pfodDesignerV2 lets you design your menus interactively and then generate the necessary Arduino sketch for a variety of boards and connection types, bluetooth, WiFi and SMS. The latest version of pfodApp (V2.0.209+) also supports playing a notification sound when the menu is displayed and setting the menu to flash to attract the user's attention. The latest version of pfodDesignerV2 (V2.0.2090+) lets you add sound and flashing to your designed menus and allows you to preview the result.

This web page will cover how to add sound to a menu and how to make a menu flash. It also covers how the user can select which sound will be played. This page will also cover the new “Ignore User Input” setting which lets you specify particular menu items as display only and ignores any user clicks on that item.

For other tutorials on using the pfodDesignerV2 to create an Android menu system with sub-menus for Arduino Compatible devices, check out the pfodDesignerV2 main page.

Adding Sound and Flashing to an existing menu

If you have already have pfodApp menu running and want to add sound or make a menu item flash, then it is as simple as adding a non-sticky <itemFormat> after the menu item's cmd. See the pfodSpecification.pdf for all the possible formats. Add @ to play a sound. Add + to make the menu text flash. Add ! to ignore user's clicks on this menu item. You can put these tags anywhere after the menu <cmd> and before the first delimiter ~ or ` . You can combine them. For example
|A+@!~Button
will make the button flash, + , play a sound, @ , and ignore user input, ! i.e. the button is disables.

If you are using pfodDesignerV2 to design a new menu and generate the code for you, you can just select the menu item options “Set to play sound”, “Set to Flash”, “Responds to User Input” to have these extras added for you.

How to select which sound plays when the menu is displayed

Even if the pfodDevice requests the pfodApp play a sound, which sound is played and if a sound is played at all is controlled by the user's mobile. For this reason you should not rely on using just a sound to attract the user's attention. You should also consider using a different background colour and flashing text to attract their attention to this menu item. You should also consider the menu item may be scrolled out of view on the screen. So setting a different background colour and flashing the text on the menu prompt is also good practice to alert the user to check the menu.

In keeping with the pfod design philosophy, the menus are specified by simple strings and the actual interpretation of these strings is left to the pfodApp running on the user's mobile. The aim is that any mobile running pfodApp will be able to connect to any pfodDevice and display the menu to the user. For sounds, this means that the device only specifies that it would like a sound to be played, by sending the extra <itemFormat> @ as part of the menu item. It is up to the pfodApp to play a sound. Different mobiles have different notification sound bites available. It is up to the user to select which one they want played. This selection of the sound is on a per connection basis. That is a different sound can be selected for each pfodDevice the user connects to. The user can also select not to play a sound at all, either by choosing “Silent” or by just putting the mobile in silent mode.

Here is how to select the sound to be played. This example uses the free pfodDemo app. The process is the same for the free pfodDesignerV2 app, to let you preview a menu with sound, and the process is also the same for the pfodApp to hear a sound when the pfodDevice you are connected to requests one.

    Download and install the free (and add free) pfodDemo. Open the pfodDemo.

    Click on the mobile's menu and select the Connections option



    The pfodApp will close the current connection and open the list of connections. On that screen, select the mobile's menu and choose the Add\Edit option




    This will open the list of connections for editing.




    Click on the connection you want to edit. For the pfodDemo, this is Sample Screens. This opens the Edit Connection screen for that connect. In that screen, click on the mobile's menu and select “Sound setting”. You can set different sounds for each of your connections.



    Selecting the “Sound setting”, will play the currently selected sound, if any, and open the sound choice screen.



    As you make selections, that sound will play. If you don't hear the sound, adjust the volume setting on your mobile. When you have chosen the sound you want played when the pfodDevice requests a sound be played, click on OK. Your selected sound will be played. Click the Save icon to save your changes for this connection and then click the mobile's back button to exit the Edit Connections screen. You can now select a connection to connect to. For the pfodDemo and pfodDesignerV2 there is only one connection available.

Now when the pfodDevice requests a sound be played to attract the user's attention. Your selected sound will be played.

Now that you have set the sound for the “Sample Screens” connection, you can click this connection name, or just exit and restart the pfodDemo app, and you will see the pfodDemo's main screen. From that screen select the “Menus and Lists” button. From that list choose the Oxygen Control Example



When the O
2 level gets too high or too low, the background turns red and the text starts flashing and a sound is played. If you don't hear a sound check your mobile's volume level and check you have selected a sound to be played, as described above, for the Sample Screens connection.

How to make a sound play repeatedly

As the above Oxygen demo above shows, you can have a sound play repeatedly. To do this for your own menus, set a refresh interval for the menu. The pfodApp will then re-request the menu at the refresh interval and play the sound each time the menu is re-displayed. The pfodDesignerV2 lets you set a re-fresh interval of a menu and will generate the necessary command.

Ignoring User Input

Sometimes when designing a menu for your pfodDevice, you use show a menu item but not have it accessible just then. For these menu items you don't want the user to click on them, or if the user does, nothing happens in the pfodDevice. With the pfodApp V2.0.208+ you can specify a menu item to ignore user input by adding ! as an <itemFormat> after the menu item cmd. This prevents the pfodApp from sending any command for this menu item.

If you are using the pfodDesignerV2, click on “Responds to User Input” to toggle the setting to “User input ignored”

However the more usual way to display information is to use a Label menu item, |!A... . The Oxygen reading shown above is an example of a Label. It is visually different from a button and does not respond user clicks.

If you are using the pfodDesignerV2, you can choose a Label menu item or one of the Display menu times to display text or data to the user that does not respond if the user clicks on it.

Conclusion

The latest version of pfodApp (V2.0.209+) now lets you make flashy and loud apps to control your micro device. You can also make menu items to ignore user input, i.e. make then display only. These creating these items are supported by the pfodDesignerV2 (V2.0.2090+), which will generate the Arduino code to send the correct pfod messages and parser the user's commands. The pfodDesignerV2 also lets you preview your menu design complete with flashing and sound.



pfodDesignerV2TM is a trademark of Forward Computing and Control Pty. Ltd.
Android
TM is a trademark of Google Inc. For use of the Arduino name see http://arduino.cc/en/Main/FAQ


pfodDevice™ and pfodApp™ are trade marks of Forward Computing and Control Pty. Ltd.


Forward home page link (image)

Contact Forward Computing and Control by
©Copyright 1996-2017 Forward Computing and Control Pty. Ltd. ACN 003 669 994