MakeBlock Drive Updated
Updated library for MakeBlock Ranger
Loading...
Searching...
No Matches
MeColorSensor.h File Reference

Header for MeColorSensor.cpp module. More...

#include <stdint.h>
#include <stdbool.h>
#include <Arduino.h>
#include "MeConfig.h"
#include "MePort.h"
Include dependency graph for MeColorSensor.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  MeColorSensor
 Driver for MeColorSensor module. More...
 

Macros

#define I2C_ERROR   (-1)
 
#define COLORSENSOR_DEFAULT_ADDRESS   (0x38)
 
#define SYSTEM_CONTROL   (0X40)
 
#define MODE_CONTROL1   (0X41)
 
#define MODE_CONTROL2   (0X42)
 
#define MODE_CONTROL3   (0X44)
 
#define RED_DATA_LSBs   (0X50)
 
#define RED_DATA_MSBs   (0X51)
 
#define GREEN_DATA_LSBs   (0X52)
 
#define GREEN_DATA_MSBs   (0X53)
 
#define BLUE_DATA_LSBs   (0X54)
 
#define BLUE_DATA_MSBs   (0X55)
 
#define CLEAR_DATA_LSBs   (0X56)
 
#define CLEAR_DATA_MSBs   (0X57)
 
#define DINT_DATA_LSBs   (0X58)
 
#define DINT_DATA_MSBs   (0X59)
 
#define INTERRUPT   (0X60)
 
#define PERSISTENCE   (0X61)
 
#define TH_LSBs   (0X62)
 
#define TH_MSBs   (0X63)
 
#define TL_LSBs   (0X64)
 
#define TL_MSBs   (0X65)
 
#define MANUFACTURER_ID   (0X92)
 
#define CHIP_ID   (0XE0)
 
#define SW_RESET   (1 << 7)
 
#define INT_RESET   (1 << 6)
 
#define MEASURE_160MS   (0x00)
 
#define MEASURE_320MS   (0x01)
 
#define MEASURE_640MS   (0x02)
 
#define MEASURE_1280MS   (0x03)
 
#define MEASURE_2560MS   (0x04)
 
#define MEASUREMENT_MAX   (0x05)
 

Enumerations

enum  COLORTYPES {
  WHITE = 0 , PINKE = 1 , RED = 2 , ORANGE = 3 ,
  YELLOW = 4 , GREEN = 5 , CYAN = 6 , BLUE = 7 ,
  PURPLE = 8 , BLACK = 9 , GOLD = 10
}
 

Detailed Description

Header for MeColorSensor.cpp module.

Author
MakeBlock
Version
V1.0.3
Date
2017/01/17
Copyright
This software is Copyright (C), 2012-2016, MakeBlock. Use is subject to license
conditions. The main licensing options available are GPL V2 or Commercial:
Open Source Licensing GPL V2
This is the appropriate option if you want to share the source code of your
application with everyone you distribute it to, and you also want to give them
the right to share who uses it. If you wish to use this software under Open
Source Licensing, you must contribute all your source code to the open source
community in accordance with the GPL Version 2 when your application is
distributed. See http://www.gnu.org/copyleft/gpl.html
Description
This file is a drive for MeColorSensor module, It supports MeColorSensor V1.0 device provided by MakeBlock.
Method List:
  1. void MeColorSensor::SensorInit(void)
  2. uint8_t MeColorSensor::ReportId(void)
  3. void MeColorSensor::ColorDataRead(void)
  4. void MeColorSensor::TurnOnLight(void)
  5. void MeColorSensor::TurnOffLight(void)
  6. uint16_t MeColorSensor::ReturnRedData(void)
  7. uint16_t MeColorSensor::ReturnGreenData(void)
  8. uint16_t MeColorSensor::ReturnBlueData(void)
  9. uint16_t MeColorSensor::ReturnColorData(void)
  10. uint8_t MeColorSensor::ColorIdentify(void)
  11. long MeColorSensor::ReturnColorCode(void)
  12. uint16_t MeColorSensor::calculateColorTemperature(void)
  13. uint16_t MeColorSensor::calculateLux(void)
  14. int8_t MeColorSensor::writeReg(int16_t reg, uint8_t data)
  15. int8_t MeColorSensor::readData(uint8_t start, uint8_t *buffer, uint8_t size)
  16. int8_t MeColorSensor::writeData(uint8_t start, const uint8_t *pData, uint8_t size)
  17. uint8_t MeColorSensor::Returnresult(void);
  18. uint8_t MeColorSensor::ReturnGrayscale(void);
  19. uint16_t MeColorSensor::ReturnColorhue(void);
  20. uint8_t MeColorSensor::MAX(uint8_t r,uint8_t g,uint8_t b);
  21. uint8_t MeColorSensor::MIN(uint8_t r,uint8_t g,uint8_t b);
  22. void MeColorSensor::TurnOffmodule(void);
  23. void MeColorSensor::TurnOnmodule(void);
  24. uint8_t MeColorSensor::ColorDataReadOnebyOne();
History:
`<Author>`         `<Time>`        `<Version>`        `<Descr>`
 zzipeng         2017/01/17          1.0.0         complete the driver code.
 zzipeng         2017/04/03          1.0.1         only detect six colors.
 zzipeng         2017/04/10          1.0.2         only detect seven colors and add methods named MeColorSensor::TurnOffmodule(void),MeColorSensor::TurnOnmodule.
 zzipeng         2017/04/20          1.0.3         add methods MeColorSensor::ColorDataReadOnebyOne();
 Lanweiting      2017/06/23          1.0.4         Canonical the code format.