0
int vss=(pulseIn(vssp, HIGH)*(1/90))**(-1);  //This line works fine
while(vss<5){
  int vss=(pulseIn(vssp, HIGH)*(1/90))**(-1);   //This is where I get the error
}

I get the error "type argument of unary '*' (have 'int')" when I try to verify the code and have no idea what it means. This is my first time programming in anything other than python so the more information you have about what i'm doing wrong, the better.

PJ Jenks
  • 31
  • 3

2 Answers2

0

you are redeclaring the variable vss which has been already declared before the while loop. Remove the int and should work.

0

** In C is not the same as ** in python. In C * could be used for multiplication or to dereference pointers

Maybe you want pow function, but be carefull with this cause it could give wrong results

If you're just trying to trying to power to -1 then you could just divide it

int vss = 1/(pulseIn(vssp, HIGH)*(1/90));

But this makes no sense, cause int can hold only integer values

And as they told you, you're redeclaring vss

Community
  • 1
  • 1
Mr. E
  • 2,070
  • 11
  • 23