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

  • Thread starter shaunaelx
  • Start date
  • Tags
    Programming
In summary, the conversation discusses the difficulty in writing a program that flashes an LED at a specific rate when a button is pressed. The desired outcome is to cycle through five preset speeds each time the button is pressed. The individual asking for help has tried using PWM and variable counters, but has not been successful. They are seeking advice on how to connect the hardware to the computer and how to command it using software. More information and a pseudocode summary of their approach is needed for others to provide assistance.
  • #1
shaunaelx
2
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
  • #2
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.
 
  • #3
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
 
  • #4
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.
 
  • #5
At least post a pseudocode
 

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

What is BASIC programming?

BASIC (Beginners All-purpose Symbolic Instruction Code) is a high-level programming language that was designed to be easy to learn and use. It was originally created in the 1960s for students and beginners to learn programming, but is still used today for various applications.

What are some common problems encountered when programming in BASIC?

Some common problems in BASIC programming include syntax errors, logical errors, and runtime errors. These can be caused by typos, incorrect use of programming statements, or issues with the computer's memory or resources.

How can I solve a programming problem in BASIC?

To solve a programming problem in BASIC, it is important to break it down into smaller parts and tackle each part step by step. This can involve testing and debugging your code, consulting resources and documentation, and seeking help from others if needed.

Are there any online resources or forums that can help me with my BASIC programming problem?

Yes, there are many online resources and forums dedicated to helping people with their BASIC programming problems. Some popular ones include Stack Overflow, Reddit's r/BASIC forum, and the BASIC Programming Language forum.

Is it possible to learn BASIC programming on my own?

Yes, it is possible to learn BASIC programming on your own. There are many resources available, such as online tutorials, books, and practice exercises, that can help you learn the basics of BASIC programming. It may also be helpful to join a community of other BASIC programmers to learn from and ask questions.

Similar threads

Back
Top