How Do You Program an LED to Flash at Different Speeds Based on Button Presses?

  • Thread starter Thread starter shaunaelx
  • Start date Start date
  • Tags Tags
    Programming
AI Thread Summary
The discussion focuses on programming an LED to flash at varying speeds based on button presses, cycling through five preset speeds. The original poster has attempted using PWM and variable counters but has encountered issues when the button is pressed multiple times. Forum members emphasize the need for more context, including hardware connections and I/O signals, to provide effective assistance. They also request pseudocode to better understand the user's approach. Without additional information, it's challenging for others to offer meaningful help.
shaunaelx
Messages
2
Reaction score
0
Im trying to write a program that flashes and LED at a rate that a button is pressed. Cycle to 1 of 5 preset speeds each time the button is pressed... cannot figure out how to do it please help :/
 
Physics news on Phys.org
shaunaelx said:
Im trying to write a program that flashes and LED at a rate that a button is pressed. Cycle to 1 of 5 preset speeds each time the button is pressed... cannot figure out how to do it please help :/

You need to read the forum rules. You have to tell us why effort you made so far, otherwise it just looks like you are asking someone to do it for you.
 
I have tried PWM and it doesn't work for me i have also tried using variable counters ... PWM doesn't seem to work if the button is pressed more than once
 
buttons and leds are not software. How is this hardware hooked to the computer? What I/O signals do you have a available from the computer? How are those commanded by the software? You have not even BEGUN to show what you have done so far or the context in which you are trying to do it.

Something that at least AMOUNTS to PWM should work, but without a LOT more information, I don't see how anyone is going to help you.
 
At least post a pseudocode
 
Back
Top