 }
 
 void computeOrder()
-{
-  if (myPID1.GetMode() == MANUAL)
+{ 
+  if (isTimeOut)
+  {
+    power1 = 0;
+    power2 = 0;
+  }
+  else
   {
     power1 = atoi(pwm1.value());
-  }
-  if (myPID2.GetMode() == MANUAL)
-  {
     power2 = atoi(pwm2.value());
   }
+    
 }
 
 void sendOrder()
 {
+  if (fabs(millis()-last_order_ms)>ORDER_RATE_ms)
+  {
+    last_order_ms = millis();
   // Order in the range -127/127
+    //SWSerial.println(127);
+      //Saturation based on posSat
    ST.motor(1, power1);
    ST.motor(2, power2);
 }
+}
  


void processSerialInput()
{
  // print the string when a newline arrives:
  if (stringComplete)
  {   
    //Serial.println(inputString);
    char ctab[inputString.length()+1];
    inputString.toCharArray(ctab, sizeof(ctab));

#include <SoftwareSerial.h>
#include <SabertoothSimplified.h>
#include <TinyGPS++.h>

const int ledPin = 13;

String inputString = "";         // a string to hold incoming data
boolean stringComplete = false;  // whether the string is complete
boolean isTimeOut = false;

//Note: NOT_A_PIN (0) was previously used for RX which is not used, but this was causing problems
SoftwareSerial SWSerial(10, 8); // RX, TX. RX on no pin (unused), TX on pin 8 (to S1).
SabertoothSimplified ST(SWSerial); // Use SWSerial as the serial port.
int power1, power2;
long lastSerialReception_ms;
long last_order_ms = 0;
#define ORDER_RATE_ms 100

TinyGPSPlus nmea;
// O stands for Opensource, R for Robokite
