make Arduino tutorial NOT using embeded LED

Hi everyone,

I am very very new to arduino and electronics ...
I am trying to replicate this tutorial

but using a different pin to connect the led.
My problem is, because they use the embeded led in this example, the led and it's resistor do not appear in the schematic. I have tried to connect a led exactly like in this other tutorial ( )
So basically I just "merged" these two schematics together ... but as you may guess it doesn't seem to be so simple.
the button does nothing and the led stays on forever ...

What am I doing wrong ? ( assuming you understood my problem ... )

which pin do you connect the led on ?
could you post your code ?

So you want to combine the two?
Connect the push button between pin 2 and Gnd, use the internal pullup resistor instead. The pin will be High when the button is not pushed, and Low when it is pushed.
Connect the LED anode to pin 12, cathode to resistor to Gnd.

byte ledPin = 12;
byte buttonPin = 2;

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

void loop(){
if (digitalRead(buttonPin) == LOW){
digitalWrite (ledPin, HIGH);
Serial.println("button closed");
digitalWrite (ledPin, LOW);
Serial.printlt ("button open");

Make sense?

I am going to try this :o) but it might take me a while :blush:
I'll keep you posted
thank you

Cut & paste the code, connect 2 things? Shouldn't take too long.

It works ^^ thank you very much .
I think, my mistake was to plug the button to the 5v pin, like in the tutorial.
that wasn't so difficult indeed, but remember I am very very new to this ^^

thank's a bunch

Yes, connecting buttons/switches to +5 is not a good practice. We’ve seen lots of cases where folks shorted 5V to Gnd and either damaged the power supply or the power loss made the board reset. Connecting an input to Gnd never hurt anything.