user33789: this is the code i made but it gives me an error about te } and also i need to know how to make delays with this
int ledPin = 4;
int buttonPin=2;
int buttonState = 0;         // variable for reading the pushbutton status

void setup() 
{
  pinMode(ledPin, OUTPUT);
  pinMode(buttonPin, INPUT);
  Serial.begin(9600);
}

void loop()
{
  if (buttonPin=(LOW);
 {
 Serial.println("someone pressed it");
}
  else
  {
    Serial.println("nothing");
  }
}

thanks for helping!

user33787: You forgot bracket here
if (buttonPin=(LOW);

Should be
if (digitalRead(buttonPin)==(LOW)){

To make a delay of 0.5 seconds for example:
delay(500);


33789: <p>this is the code i made but it gives me an error about te } and also i need to know how to make delays with this</p>

<pre><code>int ledPin = 4;
int buttonPin=2;
int buttonState = 0;         // variable for reading the pushbutton status

void setup() 
{
  pinMode(ledPin, OUTPUT);
  pinMode(buttonPin, INPUT);
  Serial.begin(9600);
}

void loop()
{
  if (buttonPin=(LOW);
 {
 Serial.println("someone pressed it");
}
  else
  {
    Serial.println("nothing");
  }
}
</code></pre>

<p>thanks for helping!</p>
 33787: <p>You forgot bracket here</p>

<pre><code>if (buttonPin=(LOW);
</code></pre>

<p>Should be</p>

<pre><code>if (digitalRead(buttonPin)==(LOW)){
</code></pre>

<p>To make a delay of 0.5 seconds for example:</p>

<pre><code>delay(500);
</code></pre>
