TopServo class Reference
Skittle Color Sorter

class TopServo

extends Servo, Context

The continuous rotation servo at the top. It spins around and moves Skittles to let the color sensor read the color.

protected Attributes

  • boolean bJammed
  • Is the Skittle stuck on the top servo.
  • boolean bRemeasuring
  • Is the Skittle's color being re-measured.
  • boolean bRemDir
  • Is the direction reversed when re-measuring the color.
  • int iRetry
  • How many times have tried to detect the color.

public Functions

  • TopServo ()
  • Constructor. Initialize all the members variables.
  • void setup ()
  • Attaches the corresponding pins to the top servo object.
  • void update ()
  • Updates the top servo. This writes the updated speed to the servo. This function should be called in the main loop.
  • void remeasureColor ()
  • Starts re-measuring the Skittle's color. This will not work if the retried times is no less than C_RETRY_UNKNOWN_COLOR.
  • void stopRemeasuring ()
  • Stops re-measuring the Skittle's color.
  • boolean isRemeasuring ()
  • Is the Skittle being re-measured its color.

Top