   {
     CAN.readMsgBuf(&len, buf);    // read data,  len: data length, buf: data buf
     unsigned int canId = CAN.getCanId();
-
-    switch (canId) 
+    Serial.println("Entrou Leitura");
+
+    switch (DataReadState) 
     {        
-      case 0x181:
+      case Current_State:
+        Serial.println("Entrou Current State");
+        if(canId == 0x381) 
+        {
         Serial.println("-----------------------------");
         Serial.print("CORRENTE: ");
         Serial.println(canId, HEX);

#define Pre_Operational     2
#define Operational         3

// Statemachine State variable and initial value
byte State = Startup;

// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is default D10

      // positionSetpoint(encoder_data);
      break;
  }
  delay(50);
}

/*********************************************************************************************************
