Using Trigonometric functions

I want to use trigonometric Identities as a function. I am unable to use it as a function but I can use it for a constant domain. Is there anyway I can put in variable in the domain of function . I am using the following code
void setup() {

  • // put your setup code here, to run once:*
  • float i=0;*

void loop() {

  • // put your main code here, to run repeatedly:*
    float i;
    *if (i>=3.142) *
  • {i = 0;*
  • }*
    float y = (-41(cos(i)));
    Serial.println (y);

i = i +0.03142;

  • }*
  float  y = (-41(cos(i)));

If you are trying to multiply by -41 then perhaps adding the multiplication operator to the code might help.

What is wrong with your program for not reacting with the cos(i); function and not printing the corresponding value on the Serial Monitor?

Delete the line float i; from loop() function; delete the line float i=0; from setup() function; declare float i; or float i = 0; in the global space. Re-run the program and check that its functionality!