(Djbrown a déplacé la page Item:End-Stop Sensor vers Item:Capteur Fin de Course) (Balise : Nouvelle redirection) |
|||
Ligne 1 : | Ligne 1 : | ||
− | # | + | {{Item |
+ | |Main_Picture=Item-TCS_3200_TCS3200.jpg | ||
+ | |Description=Capteur de couleur | ||
+ | |Categories=Matériel, Parts | ||
+ | |Cost=2.45 | ||
+ | |Currency=EUR (€) | ||
+ | |ItemLongDescription={{Info|Il doit être alimenté en 5V}}<br /> | ||
+ | =Caractéristiques : = | ||
+ | |||
+ | *alimentation maxi : 6V<br /> | ||
+ | |||
+ | =Bibliothèque : = | ||
+ | Pour utiliser le capteur de couleur il n'y a besoin d'aucunes bibliothèques | ||
+ | <br /> | ||
+ | |||
+ | =Câblage : = | ||
+ | {{#annotatedImageLight:Fichier:Item-Color Sensor TCS 3200.png|0=842px|hash=|jsondata=|mediaClass=Image|type=frameless|alt=Item-Color Sensor TCS 3200|align=center|src=https://www.wikidebrouillard.org/images/2/26/Item-Color_Sensor_TCS_3200.png|href=./Fichier:Item-Color Sensor TCS 3200.png|resource=./Fichier:Item-Color Sensor TCS 3200.png|caption=|size=842px}} | ||
+ | |||
+ | |||
+ | =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 3200 | ||
+ | |- | ||
+ | | 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" |Aucune Librairies | ||
+ | |- | ||
+ | | valign="middle" bgcolor="#999999" align="center" |Définition des pins et des variables | ||
+ | | valign="middle" align="left" |#define S0 4 | ||
+ | |||
+ | <nowiki>#</nowiki>define S1 5 | ||
+ | |||
+ | <nowiki>#</nowiki>define S2 6 | ||
+ | |||
+ | <nowiki>#</nowiki>define S3 7 | ||
+ | |||
+ | <nowiki>#</nowiki>define sensorOut 8 | ||
+ | |||
+ | int redFrequency = 0; | ||
+ | |||
+ | int greenFrequency = 0; | ||
+ | |||
+ | int blueFrequency = 0; | ||
+ | <br /> | ||
+ | |- | ||
+ | | valign="middle" height="17" bgcolor="#999999" align="center" |Dans le Setup | ||
+ | | valign="middle" bgcolor="#999999" align="center" |Configuration des pins & initialisation des valeurs | ||
+ | | valign="middle" align="left" |pinMode(S0, OUTPUT); | ||
+ | |||
+ | pinMode(S1, OUTPUT); | ||
+ | |||
+ | pinMode(S2, OUTPUT); | ||
+ | |||
+ | pinMode(S3, OUTPUT); | ||
+ | |||
+ | pinMode(sensorOut, INPUT); | ||
+ | |||
+ | digitalWrite(S0,HIGH); | ||
+ | |||
+ | digitalWrite(S1,LOW); | ||
+ | |- | ||
+ | | valign="middle" height="41" bgcolor="#999999" align="center" |Dans le Loop | ||
+ | | valign="middle" bgcolor="#999999" align="center" |Utilisation | ||
+ | | valign="middle" align="left" |redFrequency = pulseIn(sensorOut, LOW); | ||
+ | |||
+ | greenFrequency = pulseIn(sensorOut, LOW); | ||
+ | |||
+ | blueFrequency = pulseIn(sensorOut, LOW); | ||
+ | |} | ||
+ | |||
+ | =Autres fonctionnalités= | ||
+ | Aucune autres fonctionalités | ||
+ | <br /> | ||
+ | |||
+ | =Exemple : = | ||
+ | <syntaxhighlight lang="arduino"> | ||
+ | #define S0 4 | ||
+ | #define S1 5 | ||
+ | #define S2 6 | ||
+ | #define S3 7 | ||
+ | #define sensorOut 8 | ||
+ | |||
+ | int redFrequency = 0; | ||
+ | int greenFrequency = 0; | ||
+ | int blueFrequency = 0; | ||
+ | |||
+ | void setup() { | ||
+ | pinMode(S0, OUTPUT); | ||
+ | pinMode(S1, OUTPUT); | ||
+ | pinMode(S2, OUTPUT); | ||
+ | pinMode(S3, OUTPUT); | ||
+ | |||
+ | pinMode(sensorOut, INPUT); | ||
+ | |||
+ | digitalWrite(S0,HIGH); | ||
+ | digitalWrite(S1,LOW); | ||
+ | |||
+ | Serial.begin(9600); | ||
+ | } | ||
+ | void loop() { | ||
+ | digitalWrite(S2,LOW); | ||
+ | digitalWrite(S3,LOW); | ||
+ | |||
+ | redFrequency = pulseIn(sensorOut, LOW); | ||
+ | |||
+ | Serial.print("R = "); | ||
+ | Serial.print(redFrequency); | ||
+ | delay(100); | ||
+ | |||
+ | digitalWrite(S2,HIGH); | ||
+ | digitalWrite(S3,HIGH); | ||
+ | |||
+ | greenFrequency = pulseIn(sensorOut, LOW); | ||
+ | |||
+ | Serial.print(" V = "); | ||
+ | Serial.print(greenFrequency); | ||
+ | delay(100); | ||
+ | |||
+ | digitalWrite(S2,LOW); | ||
+ | digitalWrite(S3,HIGH); | ||
+ | |||
+ | blueFrequency = pulseIn(sensorOut, LOW); | ||
+ | |||
+ | Serial.print(" B = "); | ||
+ | Serial.println(blueFrequency); | ||
+ | delay(100); | ||
+ | } | ||
+ | </syntaxhighlight><br /> | ||
+ | }} | ||
+ | {{Tuto Status | ||
+ | |Complete=Published | ||
+ | }} |
Pour utiliser le capteur de couleur il n'y a besoin d'aucunes bibliothèques
TCS 3200 | ||
Avant le Setup | Importation de la bibliothèque | Aucune Librairies |
Définition des pins et des variables | #define S0 4
#define S1 5 #define S2 6 #define S3 7 #define sensorOut 8 int redFrequency = 0; int greenFrequency = 0; int blueFrequency = 0;
| |
Dans le Setup | Configuration des pins & initialisation des valeurs | pinMode(S0, OUTPUT);
pinMode(S1, OUTPUT); pinMode(S2, OUTPUT); pinMode(S3, OUTPUT); pinMode(sensorOut, INPUT); digitalWrite(S0,HIGH); digitalWrite(S1,LOW); |
Dans le Loop | Utilisation | redFrequency = pulseIn(sensorOut, LOW);
greenFrequency = pulseIn(sensorOut, LOW); blueFrequency = pulseIn(sensorOut, LOW); |
Aucune autres fonctionalités
#define S0 4
#define S1 5
#define S2 6
#define S3 7
#define sensorOut 8
int redFrequency = 0;
int greenFrequency = 0;
int blueFrequency = 0;
void setup() {
pinMode(S0, OUTPUT);
pinMode(S1, OUTPUT);
pinMode(S2, OUTPUT);
pinMode(S3, OUTPUT);
pinMode(sensorOut, INPUT);
digitalWrite(S0,HIGH);
digitalWrite(S1,LOW);
Serial.begin(9600);
}
void loop() {
digitalWrite(S2,LOW);
digitalWrite(S3,LOW);
redFrequency = pulseIn(sensorOut, LOW);
Serial.print("R = ");
Serial.print(redFrequency);
delay(100);
digitalWrite(S2,HIGH);
digitalWrite(S3,HIGH);
greenFrequency = pulseIn(sensorOut, LOW);
Serial.print(" V = ");
Serial.print(greenFrequency);
delay(100);
digitalWrite(S2,LOW);
digitalWrite(S3,HIGH);
blueFrequency = pulseIn(sensorOut, LOW);
Serial.print(" B = ");
Serial.println(blueFrequency);
delay(100);
}
Item-TCS_3200_TCS3200.jpg Published
Vous avez entré un nom de page invalide, avec un ou plusieurs caractères suivants :
< > @ ~ : * € £ ` + = / \ | [ ] { } ; ? #