颜色
来自Labplus盛思维基百科
概述
基于不同颜色物体对于RGB光线反射率不同的原理来分辨物体的颜色RGB分量。采用I2C通讯,操作简单,直接输出被测物体RGB分量值。
技术参数
- 工作电压:3.3V~5V
- 接口方式:I2C接口
- 模块尺寸:24x46x7.5mm
引脚定义
VCC | 电源 |
SDA | I2C数据 |
SCL | I2C时钟 |
GND | 地 |
使用教程
连接示意图
Arduino示例
MicroPython示例
from microbit import * def Distance(): i2c.write(0x0b, bytearray([1])) sleep(2) temp=i2c.read(0x0b,2) distanceCM=(temp[0]+temp[1]*256)/10 return distanceCM # test code while True: print(Distance()) sleep(100)