m (Djbrown a déplacé la page Item:RGB Color Sensor TCS3472 vers Item:Capteur de couleur RVB TCS3472) |
|||
Ligne 1 : | Ligne 1 : | ||
{{Item | {{Item | ||
− | |Main_Picture=Item- | + | |Main_Picture=Item-RGB_Color_Sensor_TCS3472_tcs3472.jpg |
− | |Description=Capteur de | + | |Description=Capteur de couleur RGB |
|Categories=Matériel, Parts | |Categories=Matériel, Parts | ||
− | + | |ItemLongDescription={{Info|Il doit être alimenté en 3.3V}}<br /> | |
− | + | =Caractéristiques : = | |
− | |ItemLongDescription={{Info|Il doit être alimenté en | ||
+ | *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 : = | =Câblage : = | ||
− | <br />{{#annotatedImageLight:Fichier:Item | + | <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 : = | =Le code minimal : = | ||
{| class="wikitable" cellspacing="0" border="0" | {| class="wikitable" cellspacing="0" border="0" | ||
| height="17" bgcolor="#999999" align="left" | | | height="17" bgcolor="#999999" align="left" | | ||
| valign="middle" bgcolor="#999999" align="center" | | | valign="middle" bgcolor="#999999" align="center" | | ||
− | | bgcolor="#999999" align="center" | | + | | bgcolor="#999999" align="center" |TCS 3472 |
|- | |- | ||
| rowspan="2" valign="middle" height="49" bgcolor="#999999" align="center" |Avant le Setup | | 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" bgcolor="#999999" align="center" |Importation de la bibliothèque | ||
− | | valign="middle" align="left" | | + | | valign="middle" align="left" |#include <Wire.h> |
+ | <nowiki>#</nowiki>include "Adafruit_TCS34725.h" | ||
|- | |- | ||
− | | valign="middle" bgcolor="#999999" align="center" | | + | | valign="middle" bgcolor="#999999" align="center" |Initialisation de l'objet |
− | | valign="middle" align="left" | | + | | 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" height="17" bgcolor="#999999" align="center" |Dans le Setup | ||
− | | valign="middle" bgcolor="#999999" align="center" |Configuration de | + | | valign="middle" bgcolor="#999999" align="center" |Configuration de l'objet |
− | | valign="middle" align="left" | | + | | 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= | =Autres fonctionnalités= | ||
− | Aucune autres | + | Aucune autres fonctionalités |
=Exemple : = | =Exemple : = | ||
− | <syntaxhighlight lang="arduino" | + | <syntaxhighlight lang="arduino"> |
− | + | #include <Wire.h> | |
− | + | #include "Adafruit_TCS34725.h" | |
+ | |||
+ | Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_614MS, TCS34725_GAIN_1X); | ||
void setup() { | void setup() { | ||
− | |||
Serial.begin(9600); | Serial.begin(9600); | ||
+ | |||
+ | if (tcs.begin()) { | ||
+ | Serial.println("Found sense"); | ||
+ | } else { | ||
+ | Serial.println("No TCS34725 found ... check your connections"); | ||
+ | while (1); | ||
+ | } | ||
} | } | ||
void loop() { | void loop() { | ||
− | Serial.print(" | + | 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> | </syntaxhighlight><span> </span> | ||
+ | |||
+ | <br /> | ||
}} | }} | ||
{{Tuto Status | {{Tuto Status | ||
|Complete=Published | |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("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
Vous avez entré un nom de page invalide, avec un ou plusieurs caractères suivants :
< > @ ~ : * € £ ` + = / \ | [ ] { } ; ? #