========Question 2.a) :
/*CONSTANTE*/
#define LED 13
#define tempo 1000
void setup() {
/*XAVIER jean-marie 21/10/2021
* TP1 Blinking de la LED 13
*/
pinMode(LED,OUTPUT);
}
void loop() {
// Infinity loop
digitalWrite(LED,HIGH);
delay(tempo);
digitalWrite(LED,LOW);
delay(tempo);
}
========Question 2.b) :
/*CONSTANTE*/
#define LED 13
#define tempo 200
void setup() {
/*XAVIER jean-marie 21/10/2021
* TP1 Blinking de la LED 13
*/
pinMode(LED,OUTPUT);
}
void loop() {
// Infinity loop
digitalWrite(LED,HIGH);
delay(tempo);
digitalWrite(LED,LOW);
delay(tempo);
}
Calcul :
* T(s) = 1-0 = 1s
* F(Hz) = 1 / 1(s) = 1Hz
Donc on fera clignoter la Led à 1 seconde en appliquant la valeur 1000
à la méthode (fonction) delay()
c'est-à dire mettre la variable tempo à 1000.
Rappel :
* RCycl = t(on)/ T = 20%
avec T(s) = 1/F(Hz) et t(on) la durée LED Allumée
==================================================================
EXO3 : Visualisation console texte : Liaison série
==================================================================
Programme :
/*CONSTANTE*/
#define LED 13
#define tempoH 100
#define tempoL 900
#define baud 9600
void setup() {
/*XAVIER jean-marie 21/10/2021
* TP1 Blinking de la LED 13
*/
pinMode(LED,OUTPUT); /* Initial pins*/
Serial.begin(baud); // Initial Serialconnection with terminal arduino at
9600 baud
}
void loop() {
// Infinity loop
Serial.println("Bonjour"); // print "Bonjour" on terminal at begining launch
program
digitalWrite(LED,HIGH); // LED swicth on
Serial.print("H"); // print on terminal the letter H (print() function)
delay(tempoH); // delay LED switch on
digitalWrite(LED,LOW); // LED swicth off
Serial.println("L"); // print on terminal the letter L and return to the line
(println() function)
delay(tempoL); // delay LED switch off
}
Questions :
============================================
EXO4 : Piloter Plusieurs LED
============================================
Questions :
1. Calculer la valeur des résistances pour réaliser un chenillard
Données :
4 LED :
D9 pin 9
D10 pin 10
D11 pin 11
D12 pin 12
C'est-à-dire :
* Pour une led de 5 mm ou de 3mm, Vled=Vd=1,6V
Donc Ur = 5-1,6 = 3,4 V (tension aux bornes de la
résistance
* Loi des noeuds : Ir=Iled = Ivcc pour un montage série
Application numérique :
Uvcc = 5V ; Ivcc = 40 mA; Uled = 1,6V ; Iled(3mm) = 3
mA ; Iled(5mm) = 10 mA