(Djbrown a déplacé la page Item:RGB Color Sensor TCS3472 vers Item:Capteur de couleur RVB TCS3472) (Balise : Nouvelle redirection) |
|||
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 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("Capteur Trouvé"); | ||
+ | |||
+ | } else { | ||
+ | |||
+ | Serial.println("Aucun TCS34725 trouvé ... vérifie la 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); | ||
+ | |||
+ | Serial.println("Détection des couleurs"); | ||
+ | |||
+ | Serial.print("Lux: "); | ||
+ | |||
+ | Serial.println(lux, DEC); | ||
+ | |||
+ | Serial.print("ROUGE: "); | ||
+ | |||
+ | Serial.println(r, DEC); | ||
+ | |||
+ | Serial.print("VERT: "); | ||
+ | |||
+ | Serial.println(g, DEC); | ||
+ | |||
+ | Serial.print("BLEU: "); | ||
+ | |||
+ | Serial.println(b, DEC); | ||
+ | |||
+ | <br /> | ||
+ | |} | ||
+ | =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("Capteur Trouvé"); | ||
+ | } else { | ||
+ | Serial.println("Aucun TCS34725 trouvé ... vérifier la 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("Détection des couleurs"); | ||
+ | Serial.print("Lux: "); | ||
+ | Serial.println(lux, DEC); | ||
+ | Serial.print("ROUGE: "); | ||
+ | Serial.println(r, DEC); | ||
+ | Serial.print("VERT: "); | ||
+ | Serial.println(g, DEC); | ||
+ | Serial.print("BLEU: "); | ||
+ | Serial.println(b, DEC); | ||
+ | } | ||
+ | </syntaxhighlight><span> </span> | ||
+ | |||
+ | <br /> | ||
+ | }} | ||
+ | {{Tuto Status | ||
+ | |Complete=Published | ||
+ | }} |
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
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("Capteur Trouvé"); } else { Serial.println("Aucun TCS34725 trouvé ... vérifie la 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); Serial.println("Détection des couleurs"); Serial.print("Lux: "); Serial.println(lux, DEC); Serial.print("ROUGE: "); Serial.println(r, DEC); Serial.print("VERT: "); Serial.println(g, DEC); Serial.print("BLEU: "); Serial.println(b, DEC);
|
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("Capteur Trouvé");
} else {
Serial.println("Aucun TCS34725 trouvé ... vérifier la 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("Détection des couleurs");
Serial.print("Lux: ");
Serial.println(lux, DEC);
Serial.print("ROUGE: ");
Serial.println(r, DEC);
Serial.print("VERT: ");
Serial.println(g, DEC);
Serial.print("BLEU: ");
Serial.println(b, DEC);
}
Item-RGB_Color_Sensor_TCS3472_tcs3472.jpg Published
Vous avez entré un nom de page invalide, avec un ou plusieurs caractères suivants :
< > @ ~ : * € £ ` + = / \ | [ ] { } ; ? #