user26818: I want to initialize the value of byte to -1. When I just use byte num = -1 the value ends up being a decimal 255. I've also tried int8_t number = -1 and then byte num = number but this didn't work either.

user27157: Simply -1 can't be a byte. A byte is a number from 0-255. -1 is below 0. The Arduino reference defines a byte as "A byte stores an 8-bit unsigned number, from 0 to 255.".

user4143: A byte can't be -1. A byte can only store numbers between 0 and 255 inclusive.
Depending on the range of your numbers you could use a char (-128 to +127) or an int (-32768 to +32767).

26818: <p>I want to initialize the value of byte to -1. When I just use <code>byte num = -1</code> the value ends up being a decimal 255. I've also tried <code>int8_t number = -1</code> and then <code>byte num = number</code> but this didn't work either.</p>
 27157: <p>Simply -1 can't be a byte. A byte is a number from 0-255. -1 is below 0. The Arduino reference defines a byte as "A byte stores an 8-bit unsigned number, from 0 to 255.".</p>
 4143: <p>A byte can't be -1. A byte can only store numbers between 0 and 255 inclusive.</p>

<p>Depending on the range of your numbers you could use a <code>char</code> (-128 to +127) or an <code>int</code> (-32768 to +32767).</p>
