pugliasos newlogoDEF

Orario della segreteria: tutti i martedì, dalle ore 17 alle 19, su appuntamento.


Seconda proposta (con una sola variabile char)

 

int led=13;
int pulsante=2;
char statoLED=false;

void setup() {
  pinMode(led,OUTPUT);
  pinMode(pulsante,INPUT);
}

void loop(){
  if(digitalRead(pulsante)==HIGH){
    statoLED=!statoLED;
    digitalWrite(led,statoLED);
  }
delay(250);
}

 


Terza proposta

 

int led = 13;
int pulsante = 2;

void setup() {
pinMode(led, OUTPUT);
pinMode(pulsante, INPUT);
}

void loop() {
if (digitalRead(pulsante)) {
digitalWrite(led, !digitalRead(pulsante));
}
delay(250);
}

Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Read more
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline