How to build a programm with an LED


I want to build a program that makes an LED brighter and darker again, but if a button is pressed, the LED should only flash.
Unfortunately I don't know exactly how to write this program. :slightly_frowning_face:


Have you written any code at all? Have you looked at the Arduino example sketches provided with the IDE?

Don't write it in computer, write it in human. Be precise and list every step, in human. So a complete bozo could do it with a switch.

-jim lee

Practice a couple of things first using the examples.

Work with the IDE examples provided with the Arduino software.
Grasp the basics of setup() and loop()
Testing when a switch is pressed and released.
Lighting and then dimming a LED with analogWrite()
Implement these in loop() using millis() timing (not the delay() function)
You’ll also stumble across the .’scope’ of variables.
Using Serial.print() and the ‘Serial Monitor’ will help you with debugging as you get moving.

Try, then post your attempts back here , and we’ll help you muddle through it.