   CAN.sendMsgBuf(0x601, 0, 8, pdo_actual_current_5);
   delay(10);
   CAN.sendMsgBuf(0x00, 0, 2, set_operational);
-  delay(10);
+  delay(100);
 
   Serial.println("TPDO Configured!");
   

  }
}

float currentDataRead()
{
  current_data = 0;
  unsigned char len = 0;
  unsigned char buf[8];

// clear the string:
  sync();

  if (CAN_MSGAVAIL == CAN.checkReceive())           // check if data coming


    return(current_data);
  }
}

//****************
// CAN DATA READ
//****************
void CANDataRead()
{
  unsigned char len = 0;
  unsigned char buf[8];

  if(CAN_MSGAVAIL == CAN.checkReceive())            // check if data coming
  {
    CAN.readMsgBuf(&len, buf);    // read data,  len: data length, buf: data buf
    unsigned int canId = CAN.getCanId();

    switch (canId) 
    {        
      case 0x381:
        Serial.println("-----------------------------");
        Serial.print("POSICAO");
        Serial.println(canId, HEX);

        for(int i = 0; i<len; i++)    // print the data
        {
            Serial.print(buf[i], HEX);
            Serial.print("\t");
        }
        Serial.println();
        break;
      case 0x321:
        Serial.println("-----------------------------");
        Serial.print("AMPLIFICACAO");
        Serial.println(canId, HEX);

        for(int i = 0; i<len; i++)    // print the data
        {
            Serial.print(buf[i], HEX);
            Serial.print("\t");
        }
        Serial.println();
        break;
      case 0x181:
        Serial.println("-----------------------------");
        Serial.print("CORRENTE");
        Serial.println(canId, HEX);

        for(int i = 0; i<len; i++)    // print the data
        {
            Serial.print(buf[i], HEX);
            Serial.print("\t");
        }
        Serial.println();
        break;
    }
  }
}

void loop()
