I'm making an OLED item selection screen project with a bunch of unrelated code that I probably wont put in here, but long story short, I have an integer called itemSelected which keeps track of what item is being selected. I'm really confused though because if I write something as simple as,
if (itemSelected = 4) {} (which as far as I'm aware just means if itemSelected = 4, do nothing)
the value of itemSelected immediately becomes 4. I have coded itemSelected to be = 0 on upload and still, without any input, itemSelected is = 4 on upload as if the if() function isn't even being read. Does anyone know what is happening?
That is assigning 4 to itemSelected.
if (itemSelected == 4)
Tests for equality.
Turn up your compiler warnings, and you'll see messages when you make this error.
I think that did the trick. Thanks.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.