Hbridge control using codes

Any one please help...

i have four codes inputted at analog pins...

0001
0010
0011
0100

and corresponding outputs at digital pins to control a duel H-bridge are
1010 fw
0101 rw
1001 left
0110 right

i tried to implement it using a k map solutions (see attachments) but getting errors in working,program code successfully compiled...

please help....

K MAP FOR MOVEMENTS.xlsx (9.9 KB)

hbridge.pde (884 Bytes)

 //Defenition of inputs
  boolean yo=x2;
  boolean y1=!!(x2);
  boolean y2=x3;
  boolean y3=(!!(x2))+(x3);

Why not just use a simple lookup table?

// uncompiled, untested, example code only.

const int inputPins []  = {A0, A1, A2, A3};
const int outputPins [] = {10, 11, 12, 13};
cont int lookup [16] = {0b1010, 0b1100, 0b0110, 0b0011};  // the rest are packed with zeroes
                                                          // EXAMPLE ONLY - NOT CORRECT

void setup() 
{
  for (int i = 0; i < 4; ++i) {
  	pinMode(inputPins [i], INPUT);
  	pinMode(outputPins [i], OUTPUT);
  }
}

void loop() 
{
  int input;
  for (int i = 0; i < 4; ++i) {
    bitWrite (input, i, digitalRead(inputPin[i]));
  }
  int output = lookup [input];
  for (int i = 0; i < 4; ++i) {
    digitalWrite (outputPin [i], bitRead (output, i));
  }
}

That was a real help.

thank you.