MHB BASIC: Blink LED w/ Push Button Using DO...WHILE Loop

  • Thread starter Thread starter ineedhelpnow
  • Start date Start date
  • Tags Tags
    Loop
Click For Summary
The discussion centers on using the DO...WHILE...LOOP statement to control an LED's blinking rate at two times per second while a push button is pressed. The program should pause blinking when the button is released and only resume when it is pressed and held again. To implement this, a master DO...LOOP is required to continuously check for button presses, allowing the LED blinking logic to execute within a nested DO...WHILE...LOOP. The complexity of working with APIs for circuit control is acknowledged, highlighting that while simple console operations are straightforward, integrating graphical user interfaces or circuit control can involve extensive coding and various APIs. The specific API for circuit interaction remains unclear to the participants.
ineedhelpnow
Messages
649
Reaction score
0
use the DO...WHILE...LOOP statement to blink an LED at a rate of 2 times a second as long as a push button is pressed. If the push button is not being pressed, the program should wait until the button is pressed and held before blinking the LED. To solve this problem, the DO...WHILE...LOOP will need to be inside of a separate master DO...LOOP that is used to allow our program to continuously repeat itself while waiting for a button press.

please help! i have no idea what to do.
the circuit looks something like this
View attachment 3412
 

Attachments

  • asdfdg.png
    asdfdg.png
    8.5 KB · Views: 123
Technology news on Phys.org
Writing programs that do some computations with numbers or strings and output them to a console ([m]cout[/m] in C++) is the easiest. As soon as we involve APIs (application program interfaces, i.e., libraries that deal with a specific topic), such as those that are used to write graphical user interface or control circuits, things become significantly more complicated. Not only are there different APIs for the same task, but those APIs are often huge and require writing a lot of code even for simple tasks. For example, reading a name from a console and printing "Hello, <name>" can be done in a couple of lines. Writing a program that displays a window with a text box, a button and a label (output area) may take tens of lines.

So, I have no idea which API you are supposed to use to work with circuits.
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 14 ·
Replies
14
Views
5K
  • · Replies 14 ·
Replies
14
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
6
Views
2K
  • · Replies 26 ·
Replies
26
Views
4K
Replies
5
Views
3K
  • · Replies 7 ·
Replies
7
Views
8K
  • Sticky
  • · Replies 13 ·
Replies
13
Views
7K
  • · Replies 1 ·
Replies
1
Views
3K