Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
595 B
1
Indexable
Never
int tensione,percentuale;

void setup()
{
  // put your setup code here, to run once:
pinMode(8,OUTPUT);
pinMode(7,OUTPUT);
pinMode(10,OUTPUT);
pinMode(A0,INPUT);
Serial.begin(9600);

}

void loop() {
  // put your main code here, to run repeatedly:
tensione = analogRead(A0); 
Serial.println(tensione);
percentuale=map(tensione,0,1023,0,100);  
  analogWrite (10,percentuale);
  
digitalWrite(8,HIGH);
delay(500);
digitalWrite(8,LOW);
delay(500); 
digitalWrite(7,HIGH);
delay(500);
digitalWrite(7,LOW);
delay(500);



                                          
}