LedColor and FlightEvents not working together?



  • Hello, in my college robotics class we are using the CoDrone Pro and we are having an issue doing the pushups challenge and loops in general. Our issue is that whenever we run CoDrone.LedColor() and CoDrone.FlightEvent() together inside of a for loop, only the LedColor method works and the flight events seem to be ignored. We've run variations of our code where we have just the flight events and just the color changes and that creates a new issue where the loop doesn't execute the correct number of times. We've run this method separately in setup() and loop() and they both produce the same issues. We've experimented with other drones and the loops executed the correct number of times (6), but on our drone the number tends to vary. No matter what we have tried, changing of the led color and calling a flight event don't seem to work together. Here is our code for reference.

    void pushUps() {
      for (int i = 0; i < 6; i++) {
        CoDrone.LedColor(EyeHold, Blue, 255);
        CoDrone.FlightEvent(TakeOff);
        delay(1800);
        CoDrone.LedColor(EyeHold, Red, 255);
        CoDrone.FlightEvent(Landing);
        delay(1800);
      }
      CoDrone.FlightEvent(Stop);
    }

  • administrators

    hello @rivera_richard1 you need to put a delay time of at least 50 ms. between each flightevent and ledcolor function. This is because each of those functions sends a BLE message if you try to send 2 messages at once the BLE module may ignore both. Let me know if you still have issues. Please check out this tutorial.



  • Pinging @rivera_richard1 to make sure he gets the notification of the response. Thanks, Arnold!



  • @robolink_arnold Thank you! I'll be sure to do that.


Log in to reply
 

Looks like your connection to Robolink community was lost, please wait while we try to reconnect.