 int steps_per_quarter_turn = 100;
 
 char get_nybble(char* arr, int i) {
-  if (i%2==0)
-    return arr[i]>>4;
+  if (i % 2 == 0)
+    return arr[i] >> 4;
   else
-    return arr[i]%16;
+    return arr[i] % 16;
 }
 
 char get_cmd_stepper_index(char cmd) {
-  return cmd%8;
+  return cmd % 8;
 }
 
 char get_cmd_direction(char cmd) {
-  return cmd>>3;
+  return cmd >> 3;
 }
 
-void enable_stepper(short* stepper) {
+void init_stepper(short* stepper) {
   pinMode(stepper[0], OUTPUT);
   pinMode(stepper[1], OUTPUT);
   pinMode(stepper[2], OUTPUT);

  digitalWrite(stepper[3], HIGH);
}

void step_stepper(short* stepper, int steps, int d) {
  digitalWrite(stepper[1], ((steps < 0)?HIGH:LOW));
  for (int i = 0; i < abs(steps); i++) {
    digitalWrite(stepper[0],HIGH);
    delayMicroseconds(d);
    digitalWrite(stepper[0],LOW);
    delayMicroseconds(d);
  }
}

void setup() {
  for (int i = 0; i < 6; i++) {
    enable_stepper(steppers[i]);
  }
  Serial.begin(9600);
}

void loop() {
  int n;
  if (n=Serial.available()) {
    char buf[2];

    Serial.readBytes(buf,2);
    char command = buf[0];
    char dir = buf[1];

    Serial.print(command);
    Serial.println(dir);
    
    int stepper_i = -1;
    switch (command) {
      case 'f'://front

    }

    if (stepper_i != -1) {
      if (dir == '+' || dir == '-')
        step_stepper(steppers[stepper_i], ((dir == '+') ? 1 : -1) * 100, 275);
      else if (dir == 'd')
        disable_stepper(steppers[stepper_i]);
      else if (dir == 'e')
        enable_stepper(steppers[stepper_i]);
    }
  }
}
