328p Like DAC 12-bit

By THE_HACKER
/*   ___     ________   ______      _    __  __
    / \ \   / /  _ \ \ / /  _ \    / \   \ \/ /
   / _ \ \ / /| | | \ V /| |_) |  / _ \   \  / 
  / ___ \ V / | |_| || | |  _ <  / ___ \  /  \ 
 /_/   \_\_/  |____/ |_| |_| \_\/_/   \_\/_/\_\*/



int x[12]; int y; int t = 2;



void setup (   ) {
	Serial.begin(9600);Serial.println("START"); 
	for( int i = 2; i  <  14; i++) { pinMode ( i, INPUT_PULLUP );  }
	delay ( t*5 ); 
}

void loop (   ) {
	count();
}

void count(){
	
	y = ( ( 1 * ( digitalRead ( 2 ) ) ) + ( 2 * ( digitalRead ( 3 ) ) ) + ( 4 * ( digitalRead ( 4 ) ) ) + ( 8 * ( digitalRead ( 5 ) ) ) + ( 16 * ( digitalRead ( 6 ) ) ) + ( 32 * ( digitalRead ( 7 ) ) ) + ( 64 * ( digitalRead ( 8 ) ) ) + ( 128 * ( digitalRead ( 9 ) ) ) + ( 256 * ( digitalRead ( 10 ) ) ) + ( 512 * ( digitalRead ( 11 ) ) ) + ( 1024 * ( digitalRead ( 12 ) ) ) + ( 2048 * ( digitalRead ( 13 ) ) ) ); delay ( t/2 ); Serial.println( y ); delay ( t/2 ); 
	
}