📄 colordetector.c
字号:
/******************************************************************************\
*
* File: ColorDetector.C
* Creation date: June 23, 2008 10:30
* Latest update: July 09, 2008 16:39
* Author: ClassBuilder
* XXXX
* Purpose: Method implementations of class 'ColorDetector'
* CB version: ClassBuilder Version 2.9 (PR523)
*
* Modifications: @INSERT_MODIFICATIONS(* )
* July 05, 2008 20:47 Chijinliang
* Updated code of method 'Detect'
* July 05, 2008 20:28 Chijinliang
* Updated code of method 'Detect'
* July 05, 2008 14:29 Chijinliang
* Updated code of method 'Detect'
* June 24, 2008 19:44 Chijinliang
* Updated code of method 'Detect'
* June 23, 2008 14:03 Chijinliang
* Updated code of method 'Detect'
* June 23, 2008 13:42 Chijinliang
* Updated code of method 'Detect'
* June 23, 2008 10:30 Chijinliang
* Added method 'DestructorInclude'
* Added method 'ConstructorInclude'
* Added method 'Detect'
* Added method '~ColorDetector'
*
* Copyright 2008, XXXXX
* All rights are reserved. Reproduction in whole or part is prohibited
* without the written consent of the copyright owner.
*
\******************************************************************************/
// Master include file
#include "JASTInTime.h"
using namespace JASTInTime;
/*
Destructor method.
*/
ColorDetector::~ColorDetector()
{
// Put in your own code
DestructorInclude();
}
Color ColorDetector::Detect(unsigned int sensorValue,
const Calibration& calibration)
{
if (sensorValue >= calibration.GetWhite() - 2)
{
return White;
}
else if (sensorValue <= calibration.GetBlack() + 2)
{
return Black;
}
else if (sensorValue <= (calibration.GetGray() - 1))
{
return BlackGray;
}
else if (sensorValue <= (calibration.GetGray() + 1))
{
return Gray;
}
else
{
return WhiteGray;
}
}
/*
Method which must be called first in a constructor.
*/
void ColorDetector::ConstructorInclude()
{
}
/*
Method which must be called first in a destructor.
*/
void ColorDetector::DestructorInclude()
{
}
// Methods for the relation(s) of the class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -