2.5 #203 Color I2C Brick
Overview
カラーセンサを使用したBrickです。
センサーより読み取った赤、緑、青、赤外線(明るさ)の4つのデータを、I2Cにて取得することができます。
Connecting
I2Cコネクタへ接続します。


S11059 Datasheet
Register
Schematic

Library


ライブラリ名:「FaBo 203 Color S11059」
Sample Code
I2Cコネクタに接続したColor Brickにより、赤、緑、青、赤外の値を読み取り、シリアルモニタに出力します。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 | //
// FaBo Brick Sample
//
// #203 Color Sensor I2C Brick
//
/**
@file color.ino
@brief This is an Example for the FaBo Color I2C Brick.
http://fabo.io/203.html
Released under APACHE LICENSE, VERSION 2.0
http://www.apache.org/licenses/
@author FaBo<info@fabo.io>
*/
#include <Wire.h>
#include <FaBoColor_S11059.h>
FaBoColor faboColor;
void setup() {
Serial.begin(9600);
Serial.println();
Serial.println("RESET");
faboColor.begin();
}
void loop() {
uint16_t r,g,b,i;
faboColor.readRGBI(&r, &g, &b, &i);
Serial.print("r: ");
Serial.print(r);
Serial.print(", g: ");
Serial.print(g);
Serial.print(", b: ");
Serial.print(b);
Serial.print(", i: ");
Serial.println(i);
delay(1000);
}
|
Parts
GitHub
- https://github.com/FaBoPlatform/FaBoColor-s11059-Library