expected unqualified-id before numeric constant

const int potential = 0 // pin number of the potentiometer
void setup()
{
pinMode(potential, INPUT); //initialize the potentiometer pin as an input
Serial.begin(9600); //serial start
}

void loop()
{ //looopy

int numba1; //declare integer baybayyyyy
int numba2;
numba1 = analogRead(potential); //reads potentiometer yeilds (0 through 1023)
delay(1000); //let value save
numba2 = analogRead(potential); //reads potentiometer yeilds (0 through 1023)

//Serial.println(numba1); //return potentiometer value
//Serial.println(numba2); //return potentiometer value

int finalnumba;
finalnumba = (numba1-numba2);

// boolean threshold; //true or false
int sensitivity;
sensitivity = 10; //low number makes it very sensitive, high number makes it non-sensitive

// int num;
// num = finalnumba; //make it easier to type (doesn’t really change much)

if (abs(finalnumba)>sensitivity)
{

if (finalnumba < 0) // trying to make multiple turns easier
{
Serial.println(“increased value”);
}
if (finalnumba > 0)
{
Serial.println(“decreased value”);
}
Serial.println(" ");
}

}

I get this error and I can’t quite seem to fix it:
“error: expected unqualified-id before numeric constantBad error line: -2”

Thanks for any help :slight_smile:

You forgot to add a semicolon in the first line.

const int potential = 0[glow];[/glow] // pin number of the potentiometer
void setup() 
{ 
  pinMode(potential, INPUT);  //initialize the potentiometer pin as an input
  Serial.begin(9600); //serial start 
}

void loop() 
{ //looopy

  int numba1; //declare integer baybayyyyy
  int numba2;
  numba1 = analogRead(potential); //reads potentiometer yeilds (0 through 1023)
  delay(1000); //let value save
  numba2 = analogRead(potential); //reads potentiometer yeilds (0 through 1023)

  //Serial.println(numba1); //return potentiometer value
  //Serial.println(numba2); //return potentiometer value

  int finalnumba;
  finalnumba = (numba1-numba2);

  // boolean threshold; //true or false
  int sensitivity;
  sensitivity = 10; //low number makes it very sensitive, high number makes it non-sensitive


  // int num;
  // num = finalnumba; //make it easier to type (doesn't really change much)

  if (abs(finalnumba)>sensitivity) 
  {

    if (finalnumba < 0) // trying to make multiple turns easier
    {
      Serial.println("increased value");  
    }
    if (finalnumba > 0)
    {
      Serial.println("decreased value");
    }
    Serial.println(" ");
  }



}

Lefty

thanks retrolefty :)

I'm also trying to send a command to a computer game when certain conditions are met, would this be possible through the serial commands?

I'm also trying to send a command to a computer game

"Command"? Like one ore more keystrokes? Like executing a menu item? Like a mouse click?

A keystroke or a click would do lovely, I have both a mouse and a keyboard I can gut if needbe.

Mimic a PS/2 Keyboard... http://www.arduino.cc/playground/Main/PS2Keyboard http://www.arduino.cc/playground/Main/PS2KeyboardExt

Various discussions... http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1193702598 http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1262655256 http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1252536737

Arduino as an HID device... http://www.pjrc.com/teensy/teensyduino.html http://code.rancidbacon.com/ProjectLogArduinoUSB

There are some good suggestions here... http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1258067608

Gobetwino has been suggested many times.