|
(Balise : Nouvelle redirection) |
Ligne 1 : |
Ligne 1 : |
− | {{Item
| + | #REDIRECTION [[Item:Capteur de couleur RVB TCS3472]] |
− | |Main_Picture=Item-RGB_Color_Sensor_TCS3472_tcs3472.jpg
| |
− | |Description=Capteur de couleur RGB
| |
− | |Categories=Matériel, Parts
| |
− | |ItemLongDescription={{Info|Il doit être alimenté en 3.3V}}<br />
| |
− | =Caractéristiques : =
| |
− | | |
− | *alimentation maxi : 5V<br />
| |
− | | |
− | =Bibliothèque : =
| |
− | Pour utiliser facilement ce capteur, nous vous conseillons d'utiliser la bibliothèque
| |
− | | |
− | AdaFruit TCS34725(présente dans le gestionnaire de bibliothèques arduino)
| |
− | | |
− | plus d'infos pour [[Importer des bibliothèques dans l'interface Arduino]]
| |
− | <br />{{#annotatedImageLight:Fichier:Item-RGB Color Sensor TCS3472 Library.png|0=1033px|hash=|jsondata=|mediaClass=Image|type=frameless|alt=Item-RGB Color Sensor TCS3472 Library|align=center|src=https://www.wikidebrouillard.org/images/d/df/Item-RGB_Color_Sensor_TCS3472_Library.png|href=./Fichier:Item-RGB Color Sensor TCS3472 Library.png|resource=./Fichier:Item-RGB Color Sensor TCS3472 Library.png|caption=|size=1033px}}
| |
− | | |
− | | |
− | La bibliothèque est disponible ici : https://github.com/adafruit/Adafruit_TCS34725
| |
− | | |
− | =Câblage : =
| |
− | <br />{{#annotatedImageLight:Fichier:Item-RGB Color Sensor TCS3472.png|0=908px|hash=|jsondata=|mediaClass=Image|type=frameless|alt=Item-RGB Color Sensor TCS3472|align=center|src=https://www.wikidebrouillard.org/images/6/6c/Item-RGB_Color_Sensor_TCS3472.png|href=./Fichier:Item-RGB Color Sensor TCS3472.png|resource=./Fichier:Item-RGB Color Sensor TCS3472.png|caption=|size=908px}}<br />
| |
− | =Le code minimal : =
| |
− | {| class="wikitable" cellspacing="0" border="0"
| |
− | | height="17" bgcolor="#999999" align="left" |
| |
− | | valign="middle" bgcolor="#999999" align="center" |
| |
− | | bgcolor="#999999" align="center" |TCS 3472
| |
− | |-
| |
− | | rowspan="2" valign="middle" height="49" bgcolor="#999999" align="center" |Avant le Setup
| |
− | | valign="middle" bgcolor="#999999" align="center" |Importation de la bibliothèque
| |
− | | valign="middle" align="left" |#include <Wire.h>
| |
− | <nowiki>#</nowiki>include "Adafruit_TCS34725.h"
| |
− | |-
| |
− | | valign="middle" bgcolor="#999999" align="center" |Initialisation de l'objet
| |
− | | valign="middle" align="left" |Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_614MS, TCS34725_GAIN_1X);
| |
− | |-
| |
− | | valign="middle" height="17" bgcolor="#999999" align="center" |Dans le Setup
| |
− | | valign="middle" bgcolor="#999999" align="center" |Configuration de l'objet
| |
− | | valign="middle" align="left" |if (tcs.begin()) {
| |
− | Serial.println("Found sense");
| |
− | | |
− | } else {
| |
− | | |
− | Serial.println("No TCS34725 found ... check your connections");
| |
− | | |
− | while (1);
| |
− | | |
− | }
| |
− | |-
| |
− | | valign="middle" height="41" bgcolor="#999999" align="center" |Dans le Loop
| |
− | | valign="middle" bgcolor="#999999" align="center" |Utilisation
| |
− | | valign="middle" align="left" |uint16_t r, g, b, c, colorTemp, lux;
| |
− | tcs.getRawData(&r, &g, &b, &c);
| |
− | | |
− | colorTemp = tcs.calculateColorTemperature_dn40(r, g, b, c);
| |
− | | |
− | lux = tcs.calculateLux(r, g, b);
| |
− | |}
| |
− | =Autres fonctionnalités=
| |
− | Aucune autres fonctionalités
| |
− | =Exemple : =
| |
− | <syntaxhighlight lang="arduino">
| |
− | #include <Wire.h>
| |
− | #include "Adafruit_TCS34725.h"
| |
− | | |
− | Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_614MS, TCS34725_GAIN_1X);
| |
− | | |
− | void setup() {
| |
− | Serial.begin(9600);
| |
− | | |
− | if (tcs.begin()) {
| |
− | Serial.println("Found sense");
| |
− | } else {
| |
− | Serial.println("No TCS34725 found ... check your connections");
| |
− | while (1);
| |
− | }
| |
− | }
| |
− | | |
− | void loop() {
| |
− | uint16_t r, g, b, c, colorTemp, lux;
| |
− | | |
− | tcs.getRawData(&r, &g, &b, &c);
| |
− | colorTemp = tcs.calculateColorTemperature_dn40(r, g, b, c);
| |
− | lux = tcs.calculateLux(r, g, b);
| |
− | | |
− | Serial.println("ColorSense");
| |
− | Serial.print("Lux: ");
| |
− | Serial.println(lux, DEC);
| |
− | Serial.print("RED: ");
| |
− | Serial.println(r, DEC);
| |
− | Serial.print("GREEN: ");
| |
− | Serial.println(g, DEC);
| |
− | Serial.print("BLUE: ");
| |
− | Serial.println(b, DEC);
| |
− | }
| |
− | </syntaxhighlight><span> </span>
| |
− | | |
− | <br />
| |
− | }}
| |
− | {{Tuto Status
| |
− | |Complete=Published
| |
− | }}
| |