Pin in dependence to another

Hey there,

I'm new to Arduino and therefore I've got some questions concerning my programming. I intend to write a program with one LED, a switch and sound. The LED should burn if the switch is turned on (In my current program, it works if the LED is included in the same current circuit, but then the light is very dimmed.) So if the switch is turned on, the sound pin should count how long it has been activated and after a period of time (maybe 5 seconds) there should ne a sound signal. It's important that this sequence repeats itself, when the switch is turned on after being turned off before. When the switch is off, there should be no light nor sound, of course.

Does anyone here has an example I could use for this project? Or has some clues for me, how I could write something like that?

Thanks a lot,


Please post your current code and circuit diagram. A photograph of a simple hand drawn circuit will do.

You may get some ideas from Planning and Implementing a Program


Some questions : Do you know how to read the state of an input pin reliably (pullup or pulldown resistor in place ?) Do you know how to change the state if an OUTPUT pin ? Do you know how to wire an LED to an Arduino pin using a series resistor to limit current ? Do you know how to use millis() for timing (BlinkWithoutDelay gives an example) ? What are you using to provide sound output ?