Skip to content

Migrate Color Sensor Code from 2019-2020 repo to the 2020-2021 repo #1

@DAlba-sudo

Description

@DAlba-sudo

Using the latest branch from the 2019 - 2020 repository begin the migration of our useful code.

This process will begin with our most reliable functions: Color Sensor

Begin by going to the autoBaseV5A class. This class had most of our autonomous functions.

Here is a list of functions to migrate:

  • bottomTapeSensorDetectedRedReborn1 (line 41)
  • bottomTapeSensorDetectedBlueReborn1 (line 378)
  • SkyStoneReBornRight (line 212)
  • calibrate (line 414)

Note:

The following code is used to calibrate the color sensor. Make note of the variables referenced and make sure to declare them at the top of the class so as to ensure a clean transition.

public void calibrate(ColorSensor cs) {
        int baseG = cs.green();
        int baseB = cs.blue();
        int baseR = cs.red();

        totalG = totalG + baseG;
        totalB = totalB + baseB;
        totalR = totalR + baseR;

        avgG = (totalG / iteration);
        avgB = (totalB / iteration);
        avgR = (totalR / iteration);

        iteration++;
    }

Before making these changes make sure that you are in your own branch within the migration branch!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions