Download presentation
Presentation is loading. Please wait.
1
Arduino
2
Clignotement d'une led :
int led1 = 1; int temps = 500; void setup() { pinMode(led1 , OUTPUT); } void loop() digitalWrite(led1 , HIGH); delay(temps); digitalWrite(led1 , LOW); On choisie la led n°1 Période de clignotement Etat haut de la led (5V) Etat bas de la led (ground)
3
Boucle d'asservissement d'une MCC
int omega_consigne ; int omega; float modulante; int kp = 1; int ki = 1; int vitesse_t1; int vitesse_t2; int integral_omega = 0; int flagtimer = 0; void setup() { pinMode(3, OUTPUT); delay(10); Serial.begin(9600); } void InterruptTimer2() // debut de la fonction d'interruption Timer2 void loop() analogWrite( 3, modulante); // analogWrite( 3, 90); omega = analogRead(A2); // mesuré avec la tachy omega_consigne = analogRead(A1); // envoyé avec le GBF integral_omega = integral_omega + (omega_consigne-omega)*0.05; if (integral_omega > 100){ integral_omega=100; if (integral_omega < -100 ){ integral_omega=-100;} modulante = kp*(omega_consigne - omega) + ki*integral_omega + 612; if (modulante<0) { modulante = 0; if (modulante > 1000){ modulante = 1000; Serial.println("\n sortie:"); Serial.println(modulante); Serial.println(" integrateur:"); Serial.println(integral_omega); Serial.println("mesure omega : "); Serial.println(omega); Serial.println(" mesure consigne"); Serial.println(omega_consigne); delay(300); Boucle d'asservissement d'une MCC
4
MPPT pour panneaux photovoltaïque :
int sensorPinU = A2; int sensorPinI = A3; int pwmPin = 3; // select the pin for the LED int Umes = 0; // variable to store the value coming from the sensor int Imes = 0; double Pcalcul = 0; double Pcalculold = 0; int sens = 1; int Pwm=200; void setup() { // declare the ledPin as an OUTPUT: pinMode(pwmPin, OUTPUT); delay(10); Serial.begin(9600); } void loop() { // read the value from the sensor: Umes = analogRead(sensorPinU); Imes = analogRead(sensorPinI); Pcalcul = Umes*Imes; if(Pcalcul>Pcalculold){ if(sens==1){ Pwm=Pwm+10;} else{ Pwm=Pwm-10; sens=-1;}} else if(Pcalcul<Pcalculold){ if(sens==1) Pwm=Pwm+10; sens=1;} } if(Pwm<0) Pwm=0; if(Pwm>1000) Pwm=1000; Pcalculold=Pcalcul; // turn the ledPin on analogWrite(pwmPin, Pwm); // stop the program for <sensorValue> milliseconds: Serial.println("Valeur Pwm :"); Serial.println(Pwm); Serial.println(" Tension : "); Serial.println(Umes); Serial.println(" Courant : "); Serial.println(Imes); Serial.println(" Puissance : "); Serial.println(Pcalcul); // stop the program for for <sensorValue> milliseconds: delay(1000);
5
Structure println : int sign; void setup() { // put your setup code here, to run once: Serial.begin(9600); } void loop() { sign = analogRead(A2); Serial.println(sign); // put your main code here, to run repeatedly: delay(100);
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.