Announcement

Collapse
No announcement yet.

Play Soundfile by buttom pressed event

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Play Soundfile by buttom pressed event

    Hello,

    with my µLCD-32PTU and Arduino I want to play a short Sound file if a winbutton is pressed.
    The Sound (a short click-sound) signals the user the button is pressed well.
    But where within the code the command "genie.WriteObject(GENIE_OBJ_SOUND, 0x01,0);" is to be inserted ?

    The Problem is, it sounds terrible !
    It sounds like "Brrrrrr ...", like the command is called 20 times in a row.

    What should be done so the command is called only once ?

    Here a example of the code:

    Thanks
    Thomas

    Code:
    void myGenieEventHandler(void)
    {
      genie.DequeueEvent(&Event);
      if (Event.reportObject.cmd == GENIE_REPORT_EVENT)
      {
        if (Event.reportObject.object == GENIE_OBJ_WINBUTTON)
        {
          switch (Event.reportObject.index)
          {
            case 0: genie.WriteObject(GENIE_OBJ_SOUND, 0x01, 0);
              DoAnything;
              break;
            case 1: genie.WriteObject(GENIE_OBJ_SOUND, 0x01, 0);
              DoAnything;
              break;
            case 2: genie.WriteObject(GENIE_OBJ_SOUND, 0x01, 0);
              DoAnything;
              break;
          }
        }
      }
    }
    Last edited by James_4DSystems; 19 January 2015, 06:05 AM. Reason: Put it into a Code Box

  • #2
    Hi,

    Can you send the zip file of the genie project and the arduino code if possible? so I can recreate your problem here.
    Symon

    Comment

    Working...
    X