I'm trying to send pinMode() parameters via serial using 6 bits for the pin and 2 bits for the mode. So my two-byte signal looks like this:
C-ppppppmm
Where C is the command byte, and the 6 p's are 6 bits representing the desired pin, with the two 'm' bits being the mode.
here's how my code looks for this particular command:
case DIGITAL_MODE:
while(Serial.available() < 1){}
instructionByte = Serial.read();
switch(instructionByte & B00000011)
{
case O;
pinMode( ((instructionByte >> 2) & B00111111) , OUTPUT);
break;
case 1;
pinMode( ((instructionByte >> 2) & B00111111) , INPUT);
break;
case 2;
pinMode( ((instructionByte >> 2) & B00111111) , INPUT_PULLUP);
break;
}
break;
As you can see, I'm currently using the values 0, 1, and 2. But I figure for the sake consistency, I would like to use INPUT, OUTPUT, and INPUT_PULLUP, as my cases, and then define A_INPUT, A_OUTPUT, and A_INPUT_PULLUP the exact same way.
But also, I'm just curious as well. How are INPUT, OUTPUT, and INPUT_PULLUP defined? Like if I looked at #define INPUT, what value would I see?