issue85:arduino
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
issue85:arduino [2014/11/21 22:37] – d52fr | issue85:arduino [2014/11/28 12:35] (Version actuelle) – auntiee | ||
---|---|---|---|
Ligne 7: | Ligne 7: | ||
"Let us into a variety of interactive electronic world. . ."** | "Let us into a variety of interactive electronic world. . ."** | ||
- | Le mois dernier, j'ai examiné l' | + | Le mois dernier, j'ai examiné l' |
Sunfounder 37-en-1 | Sunfounder 37-en-1 | ||
- | J'ai aussi acheté le kit de modules capteurs Sunfounder 37 (via Amazon). C'est un beau petit kit pour le prix (bien que certains « capteurs » sont simplement des pièces ordinaires montées sur un petit circuit imprimé, mais la documentation est quasi inexistante. Elle ne décrit même la disposition des connexions sur le circuit. | + | J'ai aussi acheté le kit de modules capteurs Sunfounder 37 (via Amazon). C'est un beau petit kit pour le prix (bien que certains « capteurs » soient |
« Allons à l' | « Allons à l' | ||
Ligne 20: | Ligne 20: | ||
Onwards!** | Onwards!** | ||
- | « Avec la connexion numérique d' | + | « Avec la connexion numérique d' |
+ | Ça donne à peu près le même code pour chaque module. Simplement, si le capteur est activé, la LED du point 13 (sur le circuit) s' | ||
+ | Donc, du code. J'ai lancé le code basique de chacun d'eux (montré au-dessus) pour voir la LED s' | ||
+ | |||
+ | En avant ! | ||
**What I’ve been doing is linking a couple together to practice coding. In this example I hooked up the avoidance sensor and a buzzer to light the pin 13 LED and buzz when I put my hand near the sensor. The red wire goes from + on the sensor to the live, yellow from Gnd to negative and the green wire goes from the S pin on the sensor to digital pin 3. The buzzer also goes to negative (yellow wire) with the green wire going to digital pin 2. The sensor has a fourth pin (with EN beside it) but I’ve no idea what it does. | **What I’ve been doing is linking a couple together to practice coding. In this example I hooked up the avoidance sensor and a buzzer to light the pin 13 LED and buzz when I put my hand near the sensor. The red wire goes from + on the sensor to the live, yellow from Gnd to negative and the green wire goes from the S pin on the sensor to digital pin 3. The buzzer also goes to negative (yellow wire) with the green wire going to digital pin 2. The sensor has a fourth pin (with EN beside it) but I’ve no idea what it does. | ||
Ligne 27: | Ligne 31: | ||
My code is shown below.** | My code is shown below.** | ||
+ | |||
+ | Ce que j'ai fait, c'est de relier une paire ensemble pour m’entraîner au codage. Dans cet exemple, j'ai relié le détecteur de présence et un vibreur pour éclairer la LED du contact 13 et le faire vibrer quand ma main approche le détecteur. Le fil rouge va du + sur le capteur au point haut de l' | ||
+ | |||
+ | Mon code est présenté ci-dessous. | ||
**Yes, the if statement does seem a bit backwards, but that’s the only way I could get the sensor to work properly. It took a good few hours of fiddling to get this far with no documentation, | **Yes, the if statement does seem a bit backwards, but that’s the only way I could get the sensor to work properly. It took a good few hours of fiddling to get this far with no documentation, | ||
Ligne 32: | Ligne 40: | ||
As I always say: it’s all fun and games until it starts getting hard...** | As I always say: it’s all fun and games until it starts getting hard...** | ||
+ | Oui, la condition if paraît un peu rétrograde, | ||
+ | Comme je dis toujours : ce n'est que du plaisir jusqu' | ||
+ | |||
+ | NOUVELLE BIO DE RONNIE : | ||
+ | **Ronnie is the founder and (still!) editor of Full Circle. He's a part-time arts and crafts sort of guy, and now | ||
+ | an Arduino tinkerer.** | ||
+ | |||
+ | Ronnie est le fondateur et (toujours !) le rédacteur en chef du Full Circle. C'est le genre de personne qui fait de l' | ||
TABLEAUX | TABLEAUX | ||
Ligne 62: | Ligne 78: | ||
- | int Led = 13; // | + | int Led = 13; // |
- | int Avoid = 3; // define the avoid sensor pin | + | int Avoid = 3; // définition du contact du détecteur de proximité |
- | int Buzzer = 2; // | + | int Buzzer = 2; // |
- | int val=0; | + | int val=0; |
void setup () | void setup () | ||
{ | { | ||
- | pinMode (Led, OUTPUT); | + | pinMode (Led, OUTPUT); |
- | pinMode (Avoid, INPUT); | + | pinMode (Avoid, INPUT); |
- | pinMode (Buzzer, OUTPUT); | + | pinMode (Buzzer, OUTPUT); |
} | } | ||
void loop () | void loop () | ||
{ | { | ||
- | val = digitalRead(Avoid); | + | val = digitalRead(Avoid); |
- | if (val == HIGH) // | + | if (val == HIGH) // |
{ | { | ||
- | digitalWrite (Led, LOW); // turn LED off | + | digitalWrite (Led, LOW); // éteint la LED |
- | digitalWrite (Buzzer, LOW); // | + | digitalWrite (Buzzer, LOW); // |
} | } | ||
else | else | ||
{ | { | ||
- | digitalWrite (Led, HIGH); | + | digitalWrite (Led, HIGH); |
- | digitalWrite (Buzzer, HIGH); | + | digitalWrite (Buzzer, HIGH); |
} | } | ||
} | } |
issue85/arduino.1416605874.txt.gz · Dernière modification : 2014/11/21 22:37 de d52fr