help 2 codes not working !

Hey guys been trying to get this to work all day just dont get it. I get the following error with "Charlie_Wii_Nunchuck":

C:\Documents and Settings\Owner\Desktop\arduino-0018\arduino-0018\libraries\Basic/basic.h: In function 'byte serialWaitRead()':

C:\Documents and Settings\Owner\Desktop\arduino-0018\arduino-0018\libraries\Basic/basic.h:122: error: 'Serial' was not declared in this scope

C:\Documents and Settings\Owner\Desktop\arduino-0018\arduino-0018\libraries\Basic/basic.h:123: error: 'Serial' was not declared in this scope

c:/documents and settings/owner/desktop/arduino-0018/arduino-0018/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h: At global scope:

c:/documents and settings/owner/desktop/arduino-0018/arduino-0018/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:111: error: expected unqualified-id before 'int'

c:/documents and settings/owner/desktop/arduino-0018/arduino-0018/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:111: error: expected `)' before 'int'

c:/documents and settings/owner/desktop/arduino-0018/arduino-0018/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:111: error: expected `)' before 'int'

Bad error line: -4

AND the following error with "Charlie_Advanced_RC":

C:\Documents and Settings\Owner\Desktop\arduino-0018\arduino-0018\libraries\Basic/basic.h: In function 'byte serialWaitRead()':

C:\Documents and Settings\Owner\Desktop\arduino-0018\arduino-0018\libraries\Basic/basic.h:122: error: 'Serial' was not declared in this scope

C:\Documents and Settings\Owner\Desktop\arduino-0018\arduino-0018\libraries\Basic/basic.h:123: error: 'Serial' was not declared in this scope

c:/documents and settings/owner/desktop/arduino-0018/arduino-0018/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h: At global scope:

c:/documents and settings/owner/desktop/arduino-0018/arduino-0018/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:111: error: expected unqualified-id before 'int'

c:/documents and settings/owner/desktop/arduino-0018/arduino-0018/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:111: error: expected `)' before 'int'

c:/documents and settings/owner/desktop/arduino-0018/arduino-0018/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:111: error: expected `)' before 'int'

Bad error line: -6

The codes will be posted in the the first replies! Much appreciated for you help!

THE CODE FOR CHARLIE_WII_NUNCHUCK

#include <basic.h> // this is a custom library
#include <Wire.h>

//#define debug

byte x; // axis data
byte y;
byte z;
byte l; // left motor speed 
byte r; // right "     "
boolean butC; // buttons
boolean butZ;
byte nunchuckBuffer[6]; // buffer for raw nunchuck data

void setup()
{
  analogOff(); // turn off analog inputs so I2C will work
  nunchuckIni(); // start I2C
  Serial.begin(2400); // start radio
  pinMode(3, OUTPUT);
}

void sendData(byte data, byte dataType_) // this function sends data through radio
{
  //for(byte i = 0; i < 1; i++) // resend counter, not needed
  //{
  Serial.print(dataType_, BYTE);
  Serial.print(data, BYTE);
  //}
}

void mix()
{
  // calculates desired motor speeds
  int dy; // d means delta
  int dx;
  int dl;
  int dr;
  int y_ = y;
  int x_ = x;
  int l_ = l;
  int r_ = r;

  if(y_ >= 128) // if forward
  {
    dy = y_ - 128;
    if(x_ <= 128) // if left
    {
      dx = 128 - x_;
      dl = (dy / 2) - (dx / 2);
      dr = (dy / 2) + (dx / 2);
    }
    else if(x_ > 128) // if right
    {
      dx = x_ - 128;
      dl = (dy / 2) + (dx / 2);
      dr = (dy / 2) - (dx / 2);
    }
    l_ = 128 + dl * 2;
    r_ = 128 + dr * 2;
  }
  else if(y_ < 128) // if reverse
  {
    dy = 128 - y_;
    if(x_ <= 128) // if left
    {
      dx = 128 - x_;
      dr = (dy / 2) - (dx / 2);
      dl = (dy / 2) + (dx / 2);
    }
    else if(x_ > 128) // if right
    {
      dx = x_ - 128;
      dr = (dy / 2) + (dx / 2);
      dl = (dy / 2) - (dx / 2);
    }
    l_ = 128 - dl * 2;
    r_ = 128 - dr * 2;
  }
  l = constrain(l_, 0, 255); // make sure it is in range
  r = constrain(r_, 0, 255);
}

void loop()
{
  byte dataType; // data type to be sent
  byte packet; // actual data prepared to be sent
  byte temp;
  while(1) // loop forever
  {
    nunchuckRead(); // read data from nunchucks

    // the purpose of true range is to make the number from 0 to 255, not 20 to 235 or whatever
    temp = nunchuckBuffer[0];
    nunchuckBuffer[0] = trueRange(temp, 128 - 100 + 15, 128 + 100 + 10 - 15);
    temp = nunchuckBuffer[1];
    nunchuckBuffer[1] = trueRange(temp, 128 - 100 + 15, 128 + 100 + 10 - 15);
    temp = nunchuckBuffer[2];
    nunchuckBuffer[2] = trueRange(temp, 71, 175);
    temp = nunchuckBuffer[3];
    nunchuckBuffer[3] = trueRange(temp, 71, 175);

    //temp = nunchuckBuffer[4];
    //nunchuckBuffer[4] = trueRange(temp, 0x4A, 0xB1);

    if((nunchuckBuffer[5] & B00000001) == 0) // find Z button
    {
      butZ = true; // now use accelerometer data as axis data
      x = nunchuckBuffer[2];
      y = nunchuckBuffer[3];
    } 
    else {
      butZ = false; // use joystick daa as axis data
      x = nunchuckBuffer[0];
      y = nunchuckBuffer[1];
    }
    if((nunchuckBuffer[5] & B00000010) == 0)
    {
      butC = true; // use joystick data
      x = nunchuckBuffer[0];
      y = nunchuckBuffer[1];
    } 
    else {
      butC = false;
    }

    z = nunchuckBuffer[4];
    
    // this makes the joystick tolerant of slight misalignments
    if((x > 128 - 10) & (x < 128 + 10))
    {
      x = 128;
    }
    if((y > 128 - 10) & (y < 128 + 10))
    {
      y = 128;
    }
    
    mix(); // calculate motor speeds
    
    if(butC)
    {
      // button C is used to control head and neck servos
      dataType = B11100111; // this is the dataType for head control
      packet = (x & 0xF0) + ((y & 0xF0) >> 4); // prepare packet
    } 
    else {
      dataType = B11011011; // this is the dataType for drive control
      packet = (l & 0xF0) + ((r & 0xF0) >> 4);
    }
    if((packet == B11100111) || (packet == B11011011)) // make sure data is not conflicting
    {
      packet = packet + 1;
    }
#ifndef debug
    sendData(packet, dataType); // send data to radio
#endif
    analogWrite(3, y);
#ifdef debug // if you turn on debug, use the serial monitor to read all data here
    Serial.print("X: ");
    Serial.println(x ,DEC);
    Serial.print("Y: ");
    Serial.println(y ,DEC);
    Serial.print("Z - Axis Acceleration: ");
    Serial.println(z ,DEC);
    Serial.print("Button Z: ");
    Serial.println(butZ ,DEC);
    Serial.print("Button C: ");
    Serial.println(butC ,DEC);
    Serial.print("Left: ");
    Serial.println(l ,DEC);
    Serial.print("Right: ");
    Serial.println(r ,DEC);
    Serial.print("Data Type: ");
    Serial.println(dataType, BIN);
    Serial.print("Packet: ");
    Serial.println(packet, HEX);
    delay(100);
#endif
  }
}
/*
Code mainly borrowed from
http://www.windmeadow.com/node/42

Special Thanks to Chad
*/

void nunchuckIni()
{
  Wire.begin();                      // join i2c bus as master
  Wire.beginTransmission(0x52);      // transmit to device 0x52
  Wire.send(0x40);            // sends memory address
  Wire.send(0x00);            // sends sent a zero.  
  Wire.endTransmission();      // stop transmitting
}

void nunchuckSendRequest()
{
  Wire.beginTransmission(0x52);      // transmit to device 0x52
  Wire.send(0x00);
  Wire.endTransmission();      // stop transmitting
}

void nunchuckRead()
{
  byte temp;
  double timeOut;
  Wire.requestFrom (0x52, 6);      // request data from nunchuck
  for(byte i = 0; i < 6; i++)
  {
    timeOut = 0;
    while((Wire.available() == 0) && (timeOut < 200000)) // waits for byte, or timeout after .2 million tries
    {
      timeOut++;
    }
    // receive byte
    nunchuckBuffer[i] = nunchuckDecode(Wire.receive());
  }
  nunchuckSendRequest();  // send request for next data payload
}

byte nunchuckDecode(byte x_)
{
  x_ = (x_ ^ 0x17) + 0x17; // ^ means XOR
  // Nintendo encoded their data, but this decodes it
  return x_;
}

AND FOR CHARLIE_ADVANCE_RC

#include <basic.h>

int byteToServo(byte data, unsigned range) // calculates pulse time
{
  int res;
  switch(data)
  {
  case 0:
    res = 1395;
    break;
  case 1:
    res = 1410;
    break;
  case 2:
    res = 1425;
    break;
  case 3:
    res = 1440;
    break;
  case 4:
    res = 1455;
    break;
  case 5:
    res = 1470;
    break;
  case 6:
    res = 1485;
    break;
  case 7:
    res = 1500;
    break;
  case 8:
    res = 1500;
    break;
  case 9:
    res = 1515;
    break;
  case 10:
    res = 1530;
    break;
  case 11:
    res = 1545;
    break;
  case 12:
    res = 1560;
    break;
  case 13:
    res = 1575;
    break;
  case 14:
    res = 1590;
    break;
  case 15:
    res = 1605;
    break;
  }
  return res;
}

int byteToServo2(byte data, unsigned range) // calculates pulse time
{
  int res;
  switch(data)
  {
  case 0:
    res = 975;
    break;
  case 1:
    res = 1050;
    break;
  case 2:
    res = 1125;
    break;
  case 3:
    res = 1200;
    break;
  case 4:
    res = 1275;
    break;
  case 5:
    res = 1350;
    break;
  case 6:
    res = 1425;
    break;
  case 7:
    res = 1500;
    break;
  case 8:
    res = 1500;
    break;
  case 9:
    res = 1575;
    break;
  case 10:
    res = 1650;
    break;
  case 11:
    res = 1725;
    break;
  case 12:
    res = 1800;
    break;
  case 13:
    res = 1875;
    break;
  case 14:
    res = 1950;
    break;
  case 15:
    res = 2025;
    break;
  }
  return res;
}

void setup()
{
  servoReady(); // make servo pins outputs and low
  Serial.begin(2400); // begin to listen to radio data
}

void loop()
{
  byte temp;
  int l; // wheel speeds
  int r;
  int x; // head position
  int y;
  while(1) // forever loop
  {
    temp = serialWaitRead();
#ifdef debug // display text to serial monitor
    // anything inside "#ifdef debug" won't be actually excuted unless you define debug
    Serial.print("Encoder: ");
    Serial.println(temp, BIN);
#endif
    if(temp == B11011011) // if data type is drive data
    {
      temp = serialWaitRead(); // read packet
#ifdef debug
      Serial.print("Packet: ");
      Serial.println(temp, BIN);
#endif
      serialEnd(); // disables serial interrupt
      // this ensures correct uninterrupted timing for servos
      // very important or else you can have a buffer overflow too
      l = byteToServo(15 - ((temp & 0xF0) >> 4), 125); // decode packet
      r = byteToServo(temp & 0x0F, 125);
      servoUpdateDrive(l, r); // tell servos what to do
      Serial.flush(); // clear serial buffer
      serialRestart(); // re-enable interrupt
#ifdef debug
      Serial.print("Left Speed: ");
      Serial.println(l, DEC);
      Serial.print("Right Speed: ");
      Serial.println(r, DEC);
#endif
    }
    else if(temp == B11100111) // data type to control head
    {
      temp = serialWaitRead(); // gets packet
#ifdef debug
      Serial.print("Packet: ");
      Serial.println(temp, BIN);
#endif
      serialEnd(); // same as above
      x = byteToServo2((temp & 0xF0) >> 4, 125);
      y = byteToServo2(temp & 0x0F, 125);     
      servoUpdateHead(x, y);
      Serial.flush();
      serialRestart();
#ifdef debug
      Serial.print("X: ");
      Serial.println(x, DEC);
      Serial.print("Y: ");
      Serial.println(y, DEC);
#endif
    }
  }
}
#define lMotor 6 // these are connection pin numbers
#define rMotor 5
#define xMotor 7
#define yMotor 8
#define lAdjust 10 // adjust these if servos are off center
#define rAdjust 10
#define xAdjust 10
#define yAdjust 10
#define servoMinPeriod 5 // The shortest allowable time since last servo update
#define servoEnable // disable me if you don't want the robot to move
int timeSince;
int lastUpdate;

void servoReady()
{
  pinMode(lMotor, OUTPUT);
  pinMode(rMotor, OUTPUT);
  digitalWrite(lMotor, LOW);
  digitalWrite(rMotor, LOW);
  pinMode(xMotor, OUTPUT);
  pinMode(yMotor, OUTPUT);
  digitalWrite(xMotor, LOW);
  digitalWrite(yMotor, LOW);
  lastUpdate = 0;
  timeSince = 0;
}

void servoUpdateDrive(unsigned int lSpeed, unsigned int rSpeed)
{
  lSpeed = lSpeed - 10 + lAdjust; // adjustment, see definitions above
  rSpeed = rSpeed - 10 + rAdjust;

  // this step will wait for 5ms no matter what
  timeSince = millis() - lastUpdate;
  if (timeSince < servoMinPeriod)
  {
    delay(servoMinPeriod - timeSince);
  }

  if((lSpeed < 1490) || (lSpeed > 1510))
  {
    // send pulses to servos
#ifdef servoEnable
    digitalWrite(lMotor, HIGH);
#endif
    delayMicroseconds(lSpeed);
    digitalWrite(lMotor, LOW);
  } 
  else {
    delay(2);
  }

  if((rSpeed < 1490) || (rSpeed > 1510))
  {
#ifdef servoEnable
    digitalWrite(rMotor, HIGH);
#endif
    delayMicroseconds(rSpeed);
    digitalWrite(rMotor, LOW);
  } 
  else {
    delay(2);
  }

  lastUpdate = millis();
}

void servoUpdateHead(unsigned int xPos, unsigned int yPos)
{
  xPos = xPos - 10 + xAdjust;
  yPos = yPos - 10 + yAdjust;

  timeSince = millis() - lastUpdate;
  if (timeSince < servoMinPeriod)
  {
    delay(servoMinPeriod - timeSince);
  }

#ifdef servoEnable
  digitalWrite(xMotor, HIGH);
#endif
  delayMicroseconds(xPos);
  digitalWrite(xMotor, LOW);

#ifdef servoEnable
  digitalWrite(yMotor, HIGH);
#endif
  delayMicroseconds(yPos);
  digitalWrite(yMotor, LOW);

  lastUpdate = millis();
}

Very difficult to tell from the very small font you’ve posted in, but I’m guessing you’ve got your headers in the wrong order.
(I don’t think you posted the source for “basic.h”, or at least it wasn’t labelled as such)

nope, it has located it but still no luck…

it has located it but still no luck......

I don't understand what you mean. It looks like "Serial" is being referred to before the compiler has had a description of it, so I think your headers are included in the wrong order, but from your posting it is very difficult to see what source belongs to what file.