Due to high demand expect some shipping delays at this time, orders may not ship for 1-2 business days.
0

Arduino Uno Loop Question
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Arduino Uno Loop Question

by Jmarco1955 on Fri Oct 15, 2021 1:34 pm

Greetings...In the attached sketch, my loop only runs once and stops...There are no errors compiling...I'm at a loss...Can anyone help?

Thanks in advance...Jim (NOT a programmer)
Attachments
CV_2.1.1.ino
(3.81 KiB) Downloaded 2 times

Jmarco1955
 
Posts: 7
Joined: Sun May 31, 2015 11:19 am

Re: Arduino Uno Loop Question

by adafruit_support_bill on Fri Oct 15, 2021 2:01 pm

Does i complete all 14 tracks?

adafruit_support_bill
 
Posts: 82425
Joined: Sat Feb 07, 2009 10:11 am

Re: Arduino Uno Loop Question

by Jmarco1955 on Fri Oct 15, 2021 5:20 pm

Yes Bill...After it plays track 14 the "rainbow" stops and the loop dies...

Jmarco1955
 
Posts: 7
Joined: Sun May 31, 2015 11:19 am

Re: Arduino Uno Loop Question

by adafruit_support_bill on Fri Oct 15, 2021 6:15 pm

The only thing I see that would cause it to stop is if it failed to play one of the files. Your code is designed to hang in a tight loop if any of the tracks fails to start.

What happens if you comment out all of the while(1); statements?

adafruit_support_bill
 
Posts: 82425
Joined: Sat Feb 07, 2009 10:11 am

Re: Arduino Uno Loop Question

by Jmarco1955 on Fri Oct 15, 2021 9:13 pm

That did it Bill!...I commented out the while (1) statements and it runs great now...

I need to study the example I copied that from...They seemed to be necessary but obviously not...

67 years old...Having fun learning and exploring via Adafruit...Thanks again...Jim

Jmarco1955
 
Posts: 7
Joined: Sun May 31, 2015 11:19 am

Re: Arduino Uno Loop Question

by adafruit_support_bill on Sat Oct 16, 2021 6:19 am

I see that a lot in code for some reason. It is almost never desirable for a program to simply hang without notification at the slightest sign of a problem.

adafruit_support_bill
 
Posts: 82425
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.