  analogWrite(E2, (int)(135 * x)); 
  analogWrite(E1, (int)(255 * x));
 }
-
 
 void goForward(float x) {
  digitalWrite(M1,LOW);

const int rightTrigPin = 9;
const int rightEchoPin = 8;

/*
 * Performs one-time initialization.
 * Setups pin modes and serial communication.
 */
void setup() {  
  Serial.begin(9600);
  
  pinMode(M1, OUTPUT);
  pinMode(M2, OUTPUT);

#include <SoftwareSerial.h>

String buffer = "";
char c;

SoftwareSerial btSerial(2, 3); // RX, TX

// Motor control pins.
const int E1 = 5;       // R
