Skip to main content
Arduino

Timeline for How exactly do Bicycle LEDs work? (Arduino Project)

Current License: CC BY-SA 4.0

13 events
when toggle format what by license comment
Jul 31, 2022 at 5:00 history bumped Community Bot This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Apr 2, 2022 at 4:02 history bumped Community Bot This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Mar 3, 2022 at 2:50 answer added Dave X timeline score: 0
Mar 1, 2022 at 20:15 answer added user1213320 timeline score: 1
Feb 28, 2022 at 20:38 comment added Solomon Slow @glen_geek, That's Arduino code. The Aduino library effectively calls while(true) loop(); arduino.cc/reference/en/language/structure/sketch/loop
Feb 28, 2022 at 14:04 comment added Majenko Your problem is that your LED control code is all tangled up with your button press and counter code. Separate them out into completely independent code blocks. One that just increments the counter using a button, and one that displays different things depending on the current counter value.
Feb 28, 2022 at 13:58 history migrated from electronics.stackexchange.com (revisions)
Feb 28, 2022 at 13:46 comment added brhans You're missing a counter = newcounter; line in your case 2:, but the real problem (probably, since you haven't actually described what "But I’m unable to make [Stage 2] happen" means) is almost certainly that you only have 3 blinks and then your code exits the state and returns back to the start of the loop. Sim Son has already given you one way of fixing that. Your code might work a bit more like you intend it to if you move the entire switch block outside the if (buttonState == HIGH) block. As you've written it, the case with all the blinks only executes if the button is pressed.
Feb 28, 2022 at 13:46 comment added glen_geek does loop() actually "loop"?
Feb 28, 2022 at 13:43 comment added DamienD @SimSon, you can make that an answer :)
Feb 28, 2022 at 13:37 comment added Sim Son First of all, you need to get rid of all those calls to delay() and implement it in a non-blocking way (look at BlinkWithoutDelay.ino).
Feb 28, 2022 at 13:23 comment added Justme So what is the question? Does the code "not work" and you are asking "why it does not work"? If it does not work, what does it do then and how do you expect it to work?
Feb 28, 2022 at 13:15 history asked Genki CC BY-SA 4.0

AltStyle によって変換されたページ (->オリジナル) /