codewithher / CC-Lantern

Wrapper library for programming cultural lanterns.
GNU General Public License v3.0
0 stars 0 forks source link

Bounds handling in rainbow() has unexpected behavior #25

Open totally-not-frito-lays opened 5 months ago

totally-not-frito-lays commented 5 months ago

Describe the bug Something interesting I noted in #24 is that when giving invalid input (ie. negative numbers) such as rainbow(-5) the behavior here is different than from CC-Library-Lantern. In CC-Library-Lantern the behavior was rapidly changing colors. In CC-Lantern (this repo), the behavior runs slowly, starting at orange.

This may be a quirk of our implementation of the wait() wrapper function. I'll open up a ticket for this.

To Reproduce Steps to reproduce the behavior:

  1. Open up act3-functions.ino in Arduino IDE
  2. Change rainbow(20) -> rainbow(-5)
  3. Compile and run the file
  4. See slow behavior

Expected behavior The expected behavior for negative values in the wait() call is to call delay() for 0.25 seconds. This means the colors should cycle through the entire spectrum in 0.25 seconds.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context The easiest fix is to have bounds handling inside the function itself.