Outils pour utilisateurs

Outils du site


wiki:projets:programmefinallcd

#include <Servo.h> #include <LiquidCrystal.h>

Servo myservo; LiquidCrystal lcd(11,10,9,8,7,6,5,4,3,2);

int pos = 0; int port = A0; int valeur = 0; float vin = 0; float imax = 0; int deg = 0; int n = 0;

void setup() {

Serial.begin(9600); 
myservo.attach(13);
lcd.begin(16, 2);

}

void loop()

{

for(pos = 0; pos ⇐ 190; pos += 1)

{ 
  myservo.write(pos);            
   valeur = analogRead(port);
   vin = (valeur * 5.0) / 1024.0; 
   n = n + 1 ; 
   if (vin > imax) 
     { (imax = vin); 
       (deg = n);
     }
       delay(50);
}
  
  lcd.clear();
  lcd.print(deg);
  (imax = 0);
  (deg = 0);
  (n = 0);
  

}

wiki/projets/programmefinallcd.txt · Dernière modification: 2016/09/11 13:00 (modification externe)