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
Click For Summary

Discussion Overview

The discussion revolves around programming an LED to flash at varying speeds based on button presses, with a focus on cycling through five preset speeds. Participants are seeking assistance with the implementation of this functionality.

Discussion Character

  • Technical explanation, Homework-related, Debate/contested

Main Points Raised

  • One participant expresses difficulty in writing a program that adjusts the LED flash rate according to button presses, indicating a need for help.
  • Another participant emphasizes the importance of demonstrating prior effort and understanding the forum rules, suggesting that the original poster should clarify their attempts.
  • A participant mentions trying PWM (Pulse Width Modulation) and variable counters but reports issues when the button is pressed multiple times.
  • Another participant questions the hardware setup and the connection to the computer, asking for more details about the I/O signals and the software commands involved.
  • A later reply requests the original poster to provide pseudocode to better understand their approach.

Areas of Agreement / Disagreement

Participants generally agree that more information is needed regarding the original poster's attempts and hardware setup. However, there is no consensus on the specific programming solution or approach to take.

Contextual Notes

Limitations include a lack of detail on the hardware configuration, the specific programming environment, and the original poster's prior attempts at solving the problem.

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
 

Similar threads

  • · Replies 16 ·
Replies
16
Views
5K
  • · Replies 15 ·
Replies
15
Views
3K
  • · Replies 14 ·
Replies
14
Views
6K
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
21
Views
5K
Replies
7
Views
3K
  • · Replies 27 ·
Replies
27
Views
4K
  • · Replies 9 ·
Replies
9
Views
13K
Replies
3
Views
2K