-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Description
setRGB and rainbow methods have no bounds checking, and also are using inappropriate datatypes for the values.
void qduino::setRGB(int r, int g, int b){ should instead be void qduino::setRGB(uint_8t r, uint_8t g, uint_8t b){ to limit the values to 0-255, which effectively limits it. as int, the 255-r is going to allow negative numbers to be passed to analogWrite. newr should also be uint_8t, and have a constrain() added to the map().
rainbow should be similarly constrained to prevent negative values. as is, a 0 duration would pass -125 delayMicroseconds(). there is also nothing preventing >5, which is fine unless it ends up overflowing the int.
Metadata
Metadata
Assignees
Labels
No labels