Jump to content
43oh

sine function not accepting variable argument


Recommended Posts

I assume that you are using Energia to compile and thus use the compiler supplied with Energia? If you are using a different compiler then you might want to try the general forum.

The Sketch below works for me.

 

void setup() {                
  Serial.begin(115200);
}

float deg2rad(float deg)
{
  return (deg * PI)/180.0f;
}

float deg = 0;
float s;

void loop() {
  Serial.print("sin(");
  Serial.print(deg);
  Serial.print(") = ");
  Serial.println(sin(deg2rad(deg)), DEC);
  
  deg += 1;
  if(deg > 360)
    deg = 0;  

  delay(100);
}
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...