A function previously defined here

code:

char pol = 0x91;
char u = 0;
char j = 0;
char CRC = 0;
char crc;
int Length;
char cmd = {0x7E, 0x09, 0x03, 0x05, 0x01, 0x40, 0xFF, 0x00, 0x7E} ; // [H,L,D,S,Com,D.comm,Auth,CRC,T]

char Getcrc (cmd, Length)
{
if ( j == Length )
{
cmd[7] = CRC;
}
else
{
for ( j = 0; j < Length; j++)
{
CRC = CRC ^ cmd[j]
if (u == 8)
{
j = j + 1
}
else
{
crc = CRC & 1;
if (crc == 1)
{
for (u = 0; u < 8; u++)
{
CRC = CRC ^ pol;
CRC = CRC >> 1;
}
}
else
{
CRC = CRC >> 1;
}
}
}
}
}

void setup() {
Getcrc(&cmd[1], 6);
Serial.print(“The CRC of the data is :” , CRC);
}
void loop() {
}

===========================================================
it gives me the following

CRC.ino:2:14: error: ‘cmd’ was not declared in this scope
CRC.ino:2:19: error: ‘Length’ was not declared in this scope
CRC.ino:2:25: error: expression list treated as compound expression in initializer [-fpermissive]
CRC.ino:9:14: error: redefinition of ‘char Getcrc’
CRC.ino:2:6: error: ‘char Getcrc’ previously defined here
‘cmd’ was not declared in this scope

CRC.ino (779 Bytes)

To post code and/or error messages:

  1. Use CTRL-T in the Arduino IDE to autoformat your complete code.
  2. Paste the complete autoformatted code between code tags (the </> button)
    so that we can easily see and deal with your code.
  3. Paste the complete error message between code tags (the </> button)
    so that we can easily see and deal with your messages.
  4. If you already posted without code tags, you may add the code tags by
    editing your post. Do not change your existing posts in any other way.
    You may make additional posts as needed.
  5. Please provide links to any libraries that are used
    (look for statements in your code that look like include ). Many libraries
    are named the same but have different contents.

Before posting again, you should read the three locked topics at the top of the Programming Questions forum, and any links to which these posts point.

If your project involves wiring, please provide a schematic and/or a wiring diagram and/or a clear photograph of the wiring.

char Getcrc (cmd, Length)

What data types are the 2 variables passed to this function ?