Projet MEBARKIA AMMACHE EL HELOU LUSINIER GAL
LED ALLUME :
#define LED 6
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED, HIGH); // turn the LED on (HIGH is the voltage level)
delay(2000); // wait for a second
digitalWrite(LED, LOW); // turn the LED off by making the voltage LOW
delay(2000); // wait for a second
}
BOUTON PRESSE :
#define BOUTON 2
void setup() {
// put your setup code here, to run once:
pinMode(BOUTON, INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int etat_bouton = digitalRead(BOUTON);
if(etat_bouton == 1){
Serial.println("Bouton pressé");
}
delay(100);
}
POTENTIOMETRE :
#define POT A0
void setup() {
pinMode(POT, INPUT);
Serial.begin(9600);
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
int valeur = analogRead(POT);
Serial.print("Valeur du potentiometre :");
Serial.println(valeur);
delay(200);
}