I am declaring some variables this way
byte red;
byte green;
byte blue;
I am reading the data this way:
red = Serial.parseInt();
green = Serial.parseInt();
blue = Serial.parseInt();
It works fine but I was wondering if the parsing is changing my var types from byte to int. Size is crucial for the project I am working on and keeping variables as byte would save a lot of memory.
but I was wondering if the parsing is changing my var types from byte to int.
No. Despite the name, parseInt() returns a long. Stupid not to name the function correctly, if you ask me. The value that is returned will overflow if it doesn't fit in the destination type. Your problem to deal with that.
case 22: //DPR DigitalPin Read # valid 2 - 13 Return 0, 1 for state or 2 for Error
if (verbose) {Serial.print(F("Prompting for Digital Pin Number 2 - 13: ")); }
DigPinNo = Serial.parseInt();
if (DigPinNo <2 || DigPinNo > 13) {
if (verbose) { Serial.print(DigPinNo);
Serial.print(" Pin# Error"); break; }
Serial << Err; break; }
if (verbose) { Serial.print(DigPinNo); }
if (verbose) {Serial.print(F(" Logic State = ")); }
Serial << digitalRead(DigPinNo);
if (verbose) {Serial.println(); }
break;