Announcement

Collapse
No announcement yet.

70-dt 4d buttons not working

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

  • 70-dt 4d buttons not working

    I am making a dashboard for my human powered electric vehicle and I have everything working so far except the 4d buttons to control some relays. I have scoured all of the old post and the internet, and it uses the event handler like other examples that I found but its not working. My 4dButtons are set to momentary=no. They are also set to report message. ignore the gauges and Led digits, they are working. Its only the relay part.
    Attached Files
    Last edited by badomni; 28th January 2019, 05:45 AM.

  • #2
    Hi,


    Thank you for posting your code here.

    I have also encountered the issue.
    And from your code, I come up with a code like as shown below.

    Code:
    ...
    int kvalue;
    
    void loop()
    {
        genie.doEvents();
    ...
    }
    
    
    void myGenieEventHandler(void)
    {
      genieFrame Event;
      genie.DequeueEvent(&Event);
    
       if (Event.reportObject.cmd == GENIE_REPORT_EVENT)
      {
        if (Event.reportObject.object == GENIE_OBJ_4DBUTTON)                // If the Reported Message was from a 4Dbutton
        {
          if (Event.reportObject.index == 0x02)                              // If 4Dbutton (Index = 2)
          {
            kvalue = genie.GetEventData(&Event);                      // Receive the event data from the 4Dbutton2
            Serial.print("4dbutton2:");
            Serial.println(kvalue);    
          }
    
          if (kvalue == 0) // if 4DButton2 has been Toggled Off
            {
              Serial.println("Toggle off");
            }
    
          if (kvalue == 1) // if 4DButton2 has been Toggled On
            {
              Serial.println("Toggle on");
            }   
        }
      }
    }
    Note: you can modify the code.

    Hope it helps.

    Best regards,
    Kayven

    Comment

    Working...
    X