int fanPin = 9; // Le ventilateur est branché sur le pin D9 // Définition du pin D9 comme sortie void setup() { pinMode(fanPin, OUTPUT); } // Le ventilateur fonctionne en boucle void loop() { for (int i = 0; i <= 255; i++) { // 0 correspond à aucun signal et 255 au maximum analogWrite(fanPin, 10); delay(1000); analogWrite(fanPin, 100); delay(1000); analogWrite(fanPin, 175); delay(1000); analogWrite(fanPin, 255); delay(2000); analogWrite(fanPin, 175); delay(1000); analogWrite(fanPin, 100); delay(1000); analogWrite(fanPin, 10); delay(1000); } }