user70776: int lightPin = 13;
int buttonPin = 2

void setup() {
  pinMode(lightPin, OUTPUT); //red
  pinMode(buttonPin, INPUT);
}

void loop() {
  int buttonValue = digitalRead(buttonPin);

  if (buttonValue == HIGH) {
    digitalWrite(13, HIGH);
  }  //red
  
  digitalWrite(13, LOW);//red
}  //red


user69753: In this example your missing a semi-colin after int buttonPin = 2, and your if statement should probably look like this
if (buttonValue == HIGH){
  digitalWrite(lightpin, HIGH);
}//red

else{
  digitalWrite(lightpin, LOW);//red
}//red/*

Also if you go into the examples in the Arduino IDE, under "digital", this sketch is called button.

70776: <pre class="lang-cpp prettyprint-override"><code>int lightPin = 13;
int buttonPin = 2

void setup() {
  pinMode(lightPin, OUTPUT); //red
  pinMode(buttonPin, INPUT);
}

void loop() {
  int buttonValue = digitalRead(buttonPin);

  if (buttonValue == HIGH) {
    digitalWrite(13, HIGH);
  }  //red
  
  digitalWrite(13, LOW);//red
}  //red
</code></pre>
 69753: <p>In this example your missing a semi-colin after <code>int buttonPin = 2</code>, and your if statement should probably look like this</p>
<pre><code>if (buttonValue == HIGH){
  digitalWrite(lightpin, HIGH);
}//red

else{
  digitalWrite(lightpin, LOW);//red
}//red/*
</code></pre>
<p>Also if you go into the examples in the Arduino IDE, under &quot;digital&quot;, this sketch is called button.</p>
