Hi,
I just did Design Challenge part 3 in Lesson 5 of the Arduino tutorials.
I wrote my own code and it would go through each of the modes fine, but when it got to the wave mode, pressing the button again would not return to the "off" mode.
I tested the code on the site, which of course worked fine.
I noticed that the only difference between the two was that in the wave function I had a delay(500) in my program, while the tutorial had delay(50) in their program.
I changed mine to delay(50) and the code worked fine. Then I changed the code from the tutorial to delay(500) and it had the same problem as mine.
Can anyone explain why this happens? Does the wave function have to run through a certain number of cycles or something? I don't see what in the code would be causing this.
Thanks!
Arduino Tutorial Lesson 5 Program Question
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: Arduino Tutorial Lesson 5 Program Question
During the delay, you are not checking the button state. With a longer delay you are more likely to miss the button press.
Please be positive and constructive with your questions and comments.