Mission: Roulette
The Roulette mission is a luck/skill based challenge where competitors will try to get to a target location by selecting the correct modes from a rotating selection.



The CoDrone controller will continuously cycle through various modes, each corresponding with a certain short maneuver (Forward, Right, Backwards and Left).  Each mode will be accompanied by a unique noise tone.  As the controller continuously cycles through steps, competitors will have to listen to the noise the controller makes and time their selection to go in the correct direction.  The goal is to maneuver a course by making the correct selection multiple times with minimal error.

An example of the code is shown below:



Controller Inputs:


  • The bottom left IR Sensor (IR 11) is labeled bt1 in the example code and controls the kill-switch function.  Cover this sensor to instantly stop all motors on the CoDrone.  There is no penalty for using the Stop command.

  • The bottom right IR Sensor (IR 18) is labeled bt8 in the example code and executes the current maneuver that the roulette is on.


How to Play:

Begin this challenge by triggering the right IR sensor.  THROTTLE (and YAW if set in the code) are controlled by the left joystick, but PITCH and ROLL controls are disabled.  The controller will then cycle through various PITCH and ROLL maneuvers, each accompanied by a unique sound.  By triggering the right IR sensor, the current maneuver is activated.  The activated maneuver will then execute and the roulette will restart.  The cycling rate (in milliseconds) is determined at the top of the code by the value for Interval (default 225).  The Stride value determines how long (in milliseconds) each activated maneuver will last.  The maneuver cycles as follows:

  1. Forwards  (Lowest Pitch)
  2. Right
  3. Backwards
  4. Left  (Highest Pitch)

The competitors will use timing to take off from the same location and attempt to land in the specified landing using only the right IR sensor to control their CoDrones.



Game Settings

The value for Interval (default 225) determined the milliseconds between each roulette switch.

The value for Stride (default 1000) determines the milliseconds that each maneuver executes for when selected.

If the value for Yaw enable is 1, then Yaw will be enabled. Else it will not be e


More Movement Options

To add more movement options in your roulette cycle, change the reset limit on the first if-statement and add another case to the switch case:

original 4-option



Random Mode

To make the modes switch randomly, change the statement that selects Roulette per interval to a random variable


LED Indicator

To add LED indicators, add a switch-case to the Roulette change statement and use digitalWrite() to write to LED pins.  (Only pins 13 and 16 work at the moment).

In this example:

  • Both LEDs on = Forward
  • Both LEDs off = Backward
  • Right LED on = Right
  • Left LED on = Left

Comprehensive Example:

This example is a 4-option, randomized roulette with LED indicators:

There can be multiple variations of this mission ranging in difficulty.  A few variations will include:

  • Randomization of roulette cycle
  • Checkpoints that the CoDrone must pass through
  • Random Stride lengths
  • For RokitSmart owners: Create a moving landing pad with the RokitSmart kit and try to land on it using the CoDrone

The kill-switch can be used to land in the landing zone. Challenges should be timed for competitions.

Customize and try your own Roulette missions!