expected initializer before numeric constant error plz help

//the program is supposed to run Two servos using the analog sticks on a ps3 controller using the Y axis.
//Using the Left analog stck with the Y axis on the ps3 controller to controll the Left servo.
//Using the Right analog stick with the Y axis on the ps3 controller to controll the Right servo.



#include <PS3BT.h>
#include <Servo.h> 


Servo Left;                                                                // Create servo object for steering
Servo Right;                                                             // Create servo object for throttle
USB Usb;
BTD Btd(&Usb);                                                              // You have to create the Bluetooth Dongle instance like so
PS3BT PS3(&Btd);                                                            // This will just create the instance
int val.1;                                                                  // Variable to read Left analog stick of Ps3 controller
int val.2;                                                                  // Variable to read Right analog stick of Ps3 controller
boolean printTemperature;
boolean printAngle;

void setup() 
{
  Left.attach(1);                                                          // Attaches the servo on pin 1 to the servo object
  Right.attach(2);                                                       // Attaches the servo on pin 2 to the servo object
}


void loop() 
{
  Usb.Task();

  if(PS3.PS3Connected || PS3.PS3NavigationConnected) 
{
  val.1 = PS3.getAnalogHat(LeftHatY);
  val.2 = PS3.getAnalogHat(RightHatY);
  val.1 = map(val.1, x, 0, 179);
  val.2 = map(val.2, x, 0, 179);
  Left.write(val.1);  
  Right.write(val.2);
    
  if(Ps3.disconnect)  
  (
  Left.write(pos = 0)                                                    // This is so if the car drops out of range it wont keep going and crash
  Right.write(pos = 0)                                                  // Same as above
}

i get the error “expected initializer before numeric constant” on this “int val.1;” part of the code. can any one help me thanks

int val.1;

If you are trying to name the variable "val.1", I'm afraid you can't. The dot is not allowed in variable names.

Ok then how would i make the arduino read what comes of the Left and Right analog sticks???

Choose variable names that do not have a dot "." in them. You will still have separate variables for left and right in your code. It is just the "." that is the problem.

For instance ...

int leftYVal;
int rightYVal;

so for that part of the code it should look like this?

Servo Left;                                                                // Create servo object for steering
Servo Right;                                                             // Create servo object for throttle
USB Usb;
BTD Btd(&Usb);                                                              // You have to create the Bluetooth Dongle instance like so
PS3BT PS3(&Btd);                                                            // This will just create the instance
int LeftYVal;                           //THE EDITED PART 
int RightYVal;                        //THE EDITED PART
boolean printTemperature;
boolean printAngle;

I believe that what you want is something like follow, to define the 2 joysticks of your PS3 controller.

struct {
   int X;
   int Y;
} left, right;

To access to any value, you can do something like:

 left.X = //something
 right.Y = //something
 right.X = //something

ok ok so now that i added the

int LeftYVal;                           //THE EDITED PART 
int RightYVal;                        //THE EDITED PART

it says “Val was not declared in scope” on this " val.1 = PS3.getAnalogHat(LeftHatY); " part of the code.

struct {
   int X;
   int Y;
} left, right;

That might get confusing with the two servos already declared as Left and Right :)

And the original code did just have two variables, with only the Y hat value being read.

Wizkid288, if you just want to rename the two variables, you have to do it everywhere they are used in the program, not just these declarations:

int LeftYVal;                           //THE EDITED PART 
int RightYVal;                        //THE EDITED PART

@Hackscribble: You’re right.

@Wizkid288: Try this:

//the program is supposed to run Two servos using the analog sticks on a ps3 controller using the Y axis.
//Using the Left analog stck with the Y axis on the ps3 controller to controll the Left servo.
//Using the Right analog stick with the Y axis on the ps3 controller to controll the Right servo.



#include <PS3BT.h>
#include <Servo.h> 


Servo Left;                                                                // Create servo object for steering
Servo Right;                                                             // Create servo object for throttle
USB Usb;
BTD Btd(&Usb);                                                              // You have to create the Bluetooth Dongle instance like so
PS3BT PS3(&Btd);                                                            // This will just create the instance
int LeftYVal;                                                                  // Variable to read Left analog stick of Ps3 controller
int RightYVal;                                                                  // Variable to read Right analog stick of Ps3 controller
boolean printTemperature;
boolean printAngle;

void setup() 
{
  Left.attach(1);                                                          // Attaches the servo on pin 1 to the servo object
  Right.attach(2);                                                       // Attaches the servo on pin 2 to the servo object
}


void loop() 
{
  Usb.Task();

  if(PS3.PS3Connected || PS3.PS3NavigationConnected) 
{
  LeftYVal = PS3.getAnalogHat(LeftHatY);
  RightYVal = PS3.getAnalogHat(RightHatY);
  LeftYVal = map(LeftYVal, x, 0, 179);
  RightYVal = map(RightYVal, x, 0, 179);
  Left.write(LeftYVal);  
  Right.write(RightYVal);
    
  if(Ps3.disconnect)  
  (
  Left.write(pos = 0)                                                    // This is so if the car drops out of range it wont keep going and crash
  Right.write(pos = 0)                                                  // Same as above
}

@luisilva i get an error saying "x was not declared in scope" on line

  LeftYVal = map(LeftYVal, x, 0, 179);

Because you haven't declared x anywhere. I think you should take a look at the reference for the map() function. It requires 5 arguments, and you're only passing it 3 plus a mystery one (x).

Edit: Not sure why you needed TWO threads...

well im not sure ether all i want it to do is control one servo with one analog stick on the ps3 controller using the Y axis and control the other servo with the other analog stick on the ps3 controller using the Y axis. so if you can help me do that then you have helped me.

http://arduino.cc/en/reference/map

http://www.cplusplus.com/doc/tutorial/variables/

thanks but can you just tell me how to fix the errors in this code

//the program is supposed to run Two servos using the analog sticks on a ps3 controller using the Y axis.
//Using the Left analog stck with the Y axis on the ps3 controller to controll the Left servo.
//Using the Right analog stick with the Y axis on the ps3 controller to controll the Right servo.



#include <PS3BT.h>
#include <Servo.h> 


Servo Left;                                                                // Create servo object for steering
Servo Right;                                                             // Create servo object for throttle
USB Usb;
BTD Btd(&Usb);                                                              // You have to create the Bluetooth Dongle instance like so
PS3BT PS3(&Btd);                                                            // This will just create the instance
int LeftYVal;                                                                  // Variable to read Left analog stick of Ps3 controller
int RightYVal;                                                                  // Variable to read Right analog stick of Ps3 controller
boolean printTemperature;
boolean printAngle;

void setup() 
{
  Left.attach(1);                                                          // Attaches the servo on pin 1 to the servo object
  Right.attach(2);                                                       // Attaches the servo on pin 2 to the servo object
}


void loop() 
{
  Usb.Task();

  if(PS3.PS3Connected || PS3.PS3NavigationConnected) 
{
  LeftYVal = PS3.getAnalogHat(LeftHatY);
  RightYVal = PS3.getAnalogHat(RightHatY);
  LeftYVal = map(LeftYVal, x, 0, 179);
  RightYVal = map(RightYVal, x, 0, 179);
  Left.write(LeftYVal);  
  Right.write(RightYVal);
    
  if(Ps3.disconnect)  
  (
  Left.write(pos = 0)                                                    // This is so if the car drops out of range it wont keep going and crash
  Right.write(pos = 0)                                                  // Same as above
}

i get the error"x was not declared in scope" on this part of the code

  LeftYVal = map(LeftYVal, x, 0, 179);

Wizkid288: thanks but can you just tell me how to fix the errors in this code

Fix the call to map by giving it 5 parameters. Declare x and give it some meaningful value.

ok so i changed some things in the code

//the program is supposed to run Two servos.
//Using the Left analog stck with the Y axis on the ps3 controller to controll the Left servo.
//Using the Right analog stick with the Y axis on the ps3 controller to controll the Right servo.



#include <PS3BT.h>
#include <Servo.h> 


Servo Left;                                                                // Create servo object for steering
Servo Right;                                                             // Create servo object for throttle
USB Usb;
BTD Btd(&Usb);                                                              // You have to create the Bluetooth Dongle instance like so
PS3BT PS3(&Btd);                                                            // This will just create the instance
int x;
int LeftVal;
int RightVal;                        //THE EDITED PART
boolean printTemperature;
boolean printAngle;

void setup() 
{
  Left.attach(1);                                                          // Attaches the servo on pin 1 to the servo object
  Right.attach(2);                                                       // Attaches the servo on pin 2 to the servo object
}


void loop() 
{
  Usb.Task();

  if(PS3.PS3Connected || PS3.PS3NavigationConnected) 
{
  LeftVal = PS3.getAnalogHat(LeftHatY);
  RightVal = PS3.getAnalogHat(RightHatY);
  LeftVal = map(LeftVal, x, 0, 179);
  RightVal = map(RightVal, x, 0, 179);
  Left.write(val.1);  
  Right.write(val.2);
    
  if(Ps3.disconnect)  
  (
  Left.write(pos = 0)                                                    // This is so if the controller drops out of range it wont keep going
  Right.write(pos = 0)                                                  // Same as above
}

and i added “x” because it told me to
and now i get the error “at this point in file” on this line

  LeftVal = map(LeftVal, x, 0, 179);

Map takes five values you have only given it four. You have been told this many times now.

oh i get it now @Grumpy_Mike at first i didnt know what you where talking about but now i get it.
]code]
  LeftVal = PS3.getAnalogHat(LeftHatY);
  RightVal = PS3.getAnalogHat(RightHatY);
  LeftVal = map(LeftVal, 0, 1023, 0, 179);
  RightVal = map(RightVal, 0, 1023, 0, 179);
  Left.write(LeftVal);  
  Right.write(RightVal);

see i fixed that but now i get the error "ps3 was not declared in scope"on this line

  if(Ps3.disconnect)

so what do i have to put in the scope???

so what do i have to put in the scope

That means you have not declared it as a variable and given it a value. Guess what you need to do?

In the C language, upper case and lower case are different.

if(Ps3.disconnect)

Ps3 is not the same as PS3.