Ardino - Button example.

I tried the Arduino button, but when compiling it, it sends me the below attached message.
Can someone help me with this?
Thanks and regards.

Arduino:1.8.1 (Windows 8.1), Tarjeta:“Arduino/Genuino Uno”

C:\Users\JUAN\Documents\Arduino\pushbottom-1\pushbottom-1.ino\pushbottom-1.ino.ino: In function ‘void setup()’:

pushbottom-1.ino:3: error: ‘ledPin’ was not declared in this scope

pinMode(ledPin, OUTPUT);

^

pushbottom-1.ino:5: error: ‘buttonPin’ was not declared in this scope

pinMode(buttonPin, INPUT);

^

C:\Users\JUAN\Documents\Arduino\pushbottom-1\pushbottom-1.ino\pushbottom-1.ino.ino: In function ‘void loop()’:

pushbottom-1.ino:10: error: ‘buttonState’ was not declared in this scope

buttonState = digitalRead(buttonPin);

^

pushbottom-1.ino:10: error: ‘buttonPin’ was not declared in this scope

buttonState = digitalRead(buttonPin);

^

pushbottom-1.ino:16: error: ‘ledPin’ was not declared in this scope

digitalWrite(ledPin, HIGH);

^

pushbottom-1.ino:19: error: ‘ledPin’ was not declared in this scope

digitalWrite(ledPin, LOW);

^

exit status 1
‘ledPin’ was not declared in this scope

Post your code: you probably made a simple typo.

Guessing you might have declared ledpin and buttonpin with small "p" not "P"?

manor_royal: you probably made a simple typo.

Looking at the title I would say you're right :p

This is the program as shown on the arduino page. And it does not work, can you help me? Thanks and regards

void setup() { // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPin, INPUT); }

void loop() { // read the state of the pushbutton value: buttonState = digitalRead(buttonPin);

// check if the pushbutton is pressed. // if it is, the buttonState is HIGH: if (buttonState == HIGH) { // turn LED on: digitalWrite(ledPin, HIGH); } else { // turn LED off: digitalWrite(ledPin, LOW); } }

On which page?

Anyway there should be something like

int ledPin = 13;
int buttonPin =2;

before the setup() on the page that you are referring to.

JUANSOSAM: This is the program as shown on the arduino page.

There is no such thing as the arduino page. The Arduino website has many many pages... So which one?

JUANSOSAM: And it does not work, can you help me?

Of course it doesn't. I doubt that was the whole program... How is the IDE to know what you mean with buttonPin?

And please have a look at How to use this forum. That would have told you to use code tags and to post the code in the first place ;)

This page?

Look again.....

You left a bit out, as sterretje predicted.

copy / paste can be difficult ;)

OP, If you go File > Examples > Digital in the IDE you don't even need to copy & paste the code.