Error Compilling

Hai All,

Anyone can help me to correct an error... :slightly_frowning_face:

When running the code, this error will show...

Arduino: 1.5.8 (Windows 7), Board: "Arduino Uno"

sketch_nov14a.ino: In function 'void setup()':
sketch_nov14a.ino:21:43: error: expected ')' before ';' token
sketch_nov14a.ino: In function 'void loop()':
sketch_nov14a.ino:59:40: error: expected ')' before numeric constant
sketch_nov14a.ino:59:89: error: expected ')' before ';' token
sketch_nov14a.ino:59:89: error: invalid operands of types 'long int' and 'double(double)' to binary 'operator*'
sketch_nov14a.ino:69:37: error: expected ')' before numeric constant
sketch_nov14a.ino:69:87: error: expected ')' before ';' token
sketch_nov14a.ino:69:87: error: invalid operands of types 'long int' and 'double(double)' to binary 'operator*'
Error compiling.

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.

Modify2.txt (2.36 KB)

  millimeters = (nanometers/1000000);
  centimeters = (picometers/(10000000000);
  micrometers = (centimeters/10000);

you are missing a closing parenthesis ')'.

example:
(picometers)/(10000000000)

 float picometers = 108534.81((sensorValue * (5000 / 1024))^-1.2)/1000000000;

binary operator can't work with float. i suspect you are trying to implement "raise to the power" using '^'
operator. trying to use pow() because there in no in built operator for power in c.

Let's start with some basic problems

 centimeters = (picometers/(10000000000);

has imbalanced brackets

   float picometers = 108534.81((sensorValue * (5000 / 1024))^-1.2)/1000000000;

That is not how you raise a value to a power in C. Look at the pow() function.
What do you want to do with 108534.81 ? Are you trying to multiply by it ?
These errors are repeated later in the program.

Apart from the above mentioned issues, an unsigned long can only hold a value upto 4,294,967,295 which sadly falls short of the number of picometers in a centimeter.

I think you need a rethink.

   float picometers = 108534.81((sensorValue * (5000 / 1024))^-1.2)/1000000000;

5000 / 1024 = 5. That doesn't seem like what you want. 5000.0 / 1024.0 != 5.0.

PaulS:

   float picometers = 108534.81((sensorValue * (5000 / 1024))^-1.2)/1000000000;

5000 / 1024 = 5. That doesn't seem like what you want. 5000.0 / 1024.0 != 5.0.

And then try divide that by 1000000000 :slight_smile:

    int sensorValue = analogRead(A0);  // read the input on analog pin 0:
    float picometers = 108534.81((sensorValue * (5000 / 1024))^-1.2)/1000000000;

sketch_nov15a:7: error: '1.085348125e+5' cannot be used as a function

If you want to multiply you have to explicitly put a "*" there.

As UKHeliBob said. And FYI that post took 15 seconds to be processed.