Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 4 Current »


C++

Blocks

int buttonState = 0;
int LEDPin = 11;
 
void setup()
{
  // initialize pin 2 as input and pin 11 as output
  pinMode(2, INPUT); 
  pinMode(LEDPin, OUTPUT);
}
 
void loop()
{
  buttonState = digitalRead(2); // read the button
  if (buttonState == HIGH) {
    // do something - here we just blink the LED
    digitalWrite(LEDPin, HIGH);
    delay(500);
    digitalWrite(LEDPin, LOW);
    delay(500);
  }
}


image2020-1-20_22-2-32.png


  • No labels