Skip to content

Conversation

@DaveJWalker
Copy link

scroll needs to be an unsigned integer... otherwise, it'll roll over to a negative value and 'wreak havoc' when updating the LED array in the subsequent loop. On a 32-bit processor, the int value will range from +2^31-1 top -2^31, so the rollover won't occur for a LONG time. However, on a number of Arduino platforms, the int value will only be 16-bits... so it'll roll at 32K iterations.

(I commented in the YouTube video but decided to come here as well to propose the change.)

Cheers,
Dave

scroll needs to be an unsigned integer... otherwise, it'll roll over to a negative value and 'wreak havoc' when updating the LED array in the subsequent loop.  On a 32-bit processor, the int value will range from +2^31-1 top -2^31, so the rollover won't occur for a LONG time.  However, on a number of Arduino platforms, the int value will only be 16-bits... so it'll roll at 32K iterations.

(I commented in the YouTube video but decided to come here as well to propose the change.)

Cheers,
Dave
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant