ERROR! expression cannot be used as a function

This is my code:

#include "SR04.h"
#include "math.h"

#define TRIG_PIN 5
#define ECHO_PIN 4 

SR04 sr04 = SR04(ECHO_PIN,TRIG_PIN);
long a;
int hMax = 130;
float seno1 = sin(18.6495);
float seno2 = sin(71.3505);
float vol1;
float vol2;
float vol1Max = 41846.112; 
float vol2Max = 254469.6;
float volTotalMax = 296315.712;


void setup() {
   Serial.begin(9600);
   delay(1000);
}

void loop() {
   a=sr04.Distance();
   vol2 = (3.1416(30*30))(a-40);     //Here is the problem, expression cannot be used as a function

   if (a >= 40){
    Serial.print("The volumen is: ");
    Serial.print(vol2+vol1Max);
    Serial.println("cm^3");
    delay(1000);
   }

Someone helps me :frowning:

vol2 = (3.1416(30*30))(a-40); //Here is the problem
//           ~^~     ~^~
//        No operator here

:roll_eyes:

LOOOOOOOOOOL BRO, im so stupid xD! THX A LOT!

:confounded:
 

Separately, I will point out that the sin(...) function has its argument in radians, NOT degrees.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.