     while (central.connected()) {
       // central still connected to peripheral
       if (motor1Characteristic.written()) {
-        unsigned char inputValue = motor1Characteristic.value();
+        updateMotorSpeed(motor1, motor1Characteristic.value());
+      }
 
-        int microSeconds = map(inputValue, -128, 127, 1000, 2000);
+      if (motor2Characteristic.written()) {
+        updateMotorSpeed(motor2, motor2Characteristic.value());
+      }
 
-        motor1.writeMicroseconds(microSeconds);
+      if (motor3Characteristic.written()) {
+        updateMotorSpeed(motor3, motor3Characteristic.value());
+      }
+
+      if (motor4Characteristic.written()) {
+        updateMotorSpeed(motor4, motor4Characteristic.value());
       }
     }
 

#define BLE_RST   7

#define MOTOR_1_CONTROL_PIN   6

// create peripheral instance, see pinouts above
BLEPeripheral            blePeripheral        = BLEPeripheral(BLE_REQ, BLE_RDY, BLE_RST);

  // add service and characteristic
  blePeripheral.addAttribute(sliderService);
  blePeripheral.addAttribute(motor1Characteristic);
  blePeripheral.addAttribute(motor2Characteristic);
  blePeripheral.addAttribute(motor3Characteristic);
  blePeripheral.addAttribute(motor4Characteristic);

  // begin initialization
  blePeripheral.begin();
