LEDs

Now we will learn how to control the LEDs. To do so we will use the LED Control block in the CoDrone tab. It has three options to fill in, firstly which LEDs and what pattern. The options for both the arms and the eyes are:

  • NONE, turns off the LEDs
  • HOLD, solidly on
  • MIX, mixed colors
  • FLICKER, turns on and off
  • FLICKER DOUBLE, flickers twice, then turns off, and then repeats
  • DIMMING, fades in and out

Then for just the arms it also has:

  • FLOW, LEDs turn on starting at the middle moving out towards the propellers.
  • FLOW REVERSE, LEDs turn on starting at the propellers and move towards the middle

Then the next choice is the color for the LEDs to be set to. There is a list of pre-made color options to select from.

The last option is how fast it will flicker/dim. The larger the number the slower the blink/flicker. If for the LED mode you chose HOLD, then the time is instead the brightness percentage (0 is dim, 100 is brightest).

Try it Out: Make a program that does a cool light show, use several different colors with waits to control the timing.

Example:

Challenge: Program your CoDrone to fly in a square. At each step along the way have it change LED colors. For example as it takes-off it will be green, then as it goes forward it will be purple, and so on and so forth.

Hints:

  • You can either keep the drone facing forward and just use pitch and roll, or have it turn and use yaw and pitch.
  • If looks more like a circle try having it stop (all values to 0) after each move to slow itself down before it changes direction.