Merged two projects that work fine on their own, not together- what is wrong?

Hello,
Preface: I'm new at this.

I have taken Vilros's tutorial #6 and #10 and merged them because I ultimately want to have a sensor control lighting brightness and motor speed. The closer to sensor, the brighter and faster they would go.

I'm not there yet.
Right now I just merged in one sketch those two tutorial sketches with a few adjustments.
The motor serial read works fine.
The lighting doesn't.

Whenever I //comment out the serialSpeed command, the lights work. But when on, it doesn't.

Can someone please take a look at my code and let me know where there is a mistake?

My connections are as described in tutorial except the motor is now on Pin 10. (see attached pic).

Thanks!

Circuit_06_Test.ino (1.86 KB)

  while(true)  // "true" is always true, so this will loop forever.

serialSpeed() has an infinite loop in it (starting with the while(true) line.

Once your program gets to that bit, it loops and loops forever, and doesn't do anything else, like reading the light sensor or controlling brightness.

You need to re-structure your program so there's just one loop that does everything you need.

Yep, that's exactly what it was!
Thank you much.
A.