Button -> Arduino -> LED Relationship

Hey everyone!

I was thinking about what the code would look like if someone wanted to blink an LED by sending data into the arduino from a button? I know the traditional way is to use the button as a part of the circuit, but how would one use it to transfer data into the arduino, then into the light?

Any leads are very much appreciated, I've been thinking about this for a while...

A bit of a vague request. What does transferring data from a button actually mean? And also what do you mean by transferring data into a light?

Do you mean attaching a button to an Arduino on one pin, and making it light up an LED on another pin light up when the button is pressed? If so look at the examples in the IDE filed under Basic.

The code would look like a digitalRead of the input pin followed by an “if” statement that sets the output pin high or low depending on what was read in the first statement.

You could use Morse code to send data to the Uno from a button.


(Gotta smile at the tagline. But it might be better than what we have now. :roll_eyes: )

Gotta smile at the tagline.

From Monty Python and the holy grail.

holdingpattern: I thought that's what OP meant by this: ... but I'm not picturing his or her non-traditional way.

Yes but the word data is rather ambiguous in this context.

I imaging the traditional way is just a battery switch and resistor. So sticking an Arduino in the mix would be non traditional.