Go Down

Topic: exit status 1 ;expected unqualified-id before numeric constant, please help! (Read 69 times) previous topic - next topic

jamjam6221

I am getting the exit status 1; expected unqualified-id before numeric constant on line 12 and it also might be on other lines. here is the full code. it is to make a foot pedal have an output of a smaller voltage that can not be made by the foot pedal itself. this whole thing is for an electric go-kart project I am doing made out of a car alternator and car batteries. ('hio' is the voltage output) (i am using an Arduino UNO)

const int analogPin = A0;    // pin that the sensor is attached to
const int hio = 11;       // pin that the inner coil of the alternator is attached to
const int 10 = 243;
const int 20 = 216;
const int 30 = 189;
const int 40 = 162;
const int 50 = 135;
const int 60 = 108;
const int 70 = 81;
const int 80 = 54;
const int 90 = 27;
const int 100 = 0;

void setup() {
  // initialize the LED pin as an output:
  pinMode(hio, OUTPUT);
  // initialize serial communications:
  Serial.begin(9600);
}

void loop() {
  // read the value of the potentiometer:
  int analogValue = analogRead(analogPin);

  // if the analog value is high enough, turn on the LED:
  if (analogValue > 10) {
    analogWrite(hio, 95);
  } else {
    analogWrite(hio, LOW);
  }
 if (analogValue > 20) {
    analogWrite(hio, 82);
  } else {
    analogWrite(hio, LOW);
  }
 if (analogValue > 30) {
    analogWrite(hio, 76);
  } else {
    analogWrite(hio, LOW);
  }
 if (analogValue > 40) {
    analogWrite(hio, 70);
  } else {
    analogWrite(hio, LOW);
  }
 if (analogValue > 50) {
    analogWrite(hio, 64);
  } else {
    analogWrite(hio, LOW);
  }
   if (analogValue > 60) {
    analogWrite(hio, 57);
  } else {
    analogWrite(hio, LOW);
  }
 if (analogValue > 70) {
    analogWrite(hio, 44);
  } else {
    analogWrite(hio, 0);
  }
if (analogValue > 80) {
    analogWrite(hio, 41);
  } else {
    analogWrite(hio, 0);
  }
  if (analogValue > 90) {
    analogWrite(hio, 32);
  } else {
    analogWrite(hio, 0);
  }
  if (analogValue > 100) {
    analogWrite(hio, 29);
  } else {
    analogWrite(hio, 0);
  }
  // print the analog value:
  Serial.println(analogValue);
  delay(1);        // delay in between reads for stability
}

sterretje

Please read How to use this forum - please read, specifically point #7 about posting code; next edit your post and use code tags.

The error is caused by the fact that variable names can't start with a number.

If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

J-M-L

Please read the forum rules and correct your post above and add code tags around your code:
[code] // your code is here [/code].

It should look like this:
Code: [Select]
// your code is here
(Also press ctrl-T (PC) or cmd-T (Mac) in the IDE before copying to indent your code properly)

-----
This is wrong
Code: [Select]
const int 10 = 243;
const int 20 = 216;
const int 30 = 189;
const int 40 = 162;
const int 50 = 135;
const int 60 = 108;
const int 70 = 81;
const int 80 = 54;
const int 90 = 27;
const int 100 = 0;
your variable names are not legit, you can't redefine numbers to have another value...
Hello - Please do not PM me for help,  others will benefit as well if you post your question publicly on the forums.
Bonjour Pas de messages privés SVP, postez dans le forum directement pour que ça profite à tous

TheMemberFormerlyKnownAsAWOL

you can't redefine numbers to have another value...
...unless you are an accredited politician.

J-M-L

Hello - Please do not PM me for help,  others will benefit as well if you post your question publicly on the forums.
Bonjour Pas de messages privés SVP, postez dans le forum directement pour que ça profite à tous

Go Up