(Page créée avec « {{Item |Main_Picture=Item-RGB_Color_Sensor_TCS3472_tcs3472.jpg |Description=Capteur de couleur RGB |Categories=Matériel, Parts |ItemLongDescription={{Info|Il doit être a... ») |
|||
Ligne 1 : | Ligne 1 : | ||
+ | {{Item | ||
+ | |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 cecapteur, 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 | ||
+ | }} |
Pour utiliser facilement cecapteur, 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
La bibliothèque est disponible ici : https://github.com/adafruit/Adafruit_TCS34725
TCS 3472 | ||
Avant le Setup | Importation de la bibliothèque | #include <Wire.h>
#include "Adafruit_TCS34725.h" |
Initialisation de l'objet | Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_614MS, TCS34725_GAIN_1X); | |
Dans le Setup | Configuration de l'objet | if (tcs.begin()) {
Serial.println("Found sense"); } else { Serial.println("No TCS34725 found ... check your connections"); while (1); } |
Dans le Loop | Utilisation | 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); |
Aucune autres fonctionalités
#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);
}
Item-RGB_Color_Sensor_TCS3472_tcs3472.jpg Published
Cliquer sur une date et heure pour voir le fichier tel qu'il était à ce moment-là.
Date et heure | Vignette | Dimensions | Utilisateur | Commentaire | |
---|---|---|---|---|---|
actuel | 3 mai 2023 à 16:43 | 1 033 × 196 (18 Kio) | Djbrown (discussion | contributions) |
La page suivante utilise ce fichier :
Résolution horizontale | 47,24 p/cm |
---|---|
Résolution verticale | 47,24 p/cm |
Vous avez entré un nom de page invalide, avec un ou plusieurs caractères suivants :
< > @ ~ : * € £ ` + = / \ | [ ] { } ; ? #