Equality comparison in C and C++ is expressed by
==operator.==, not=. Thisif (wavecolor = 0) {
actually assigns zero to your wavecolor variable, thus destroying the value you just read.
The common sense says that you actually need
andin your conditions, notorif (wavecolor > 0 and wavecolor < 333) {
The or conditions that you curently use are simply always true, which makes them nonsensical.
This is valid syntax
if (wavecolor > 0 or wavecolor < 333) if (wavecolor > 0 and wavecolor < 333)
but you might want to try using more "canonical" forms
if (wavecolor > 0 || wavecolor < 333) if (wavecolor > 0 && wavecolor < 333) or and and are "alternative" forms of || and && operators, introduced a long time ago for reasons that are all but obsolete today.
Assuming that you meant
andinstead ofor, in your conditions you managed to "exclude" such values as333,667and1022- they wouldn't match any ofandconditions. Changing some strict comparisons to non-strict ones might be in order.As a side note, in a single-file program all file-scope variables should be either
constorstatic. In your caseconst int redpin = 6; const int greenpin = 3; const int bluepin = 5; const int potPin = 0;