sin()
Description
Calcule le sinus d'un angle (en radians). Le résultat sera entre -1 et 1.
Syntaxe
sin(rad);
Paramètres
- rad: l'angle en radians (float)
Valeurs Renvoyées
- Le sinus de l'angle (double) (entre -1 et 1)
Exemple
void setup() {
Serial.begin(9600);
for (int angle = 0; angle <= 180; angle += 15) {
float angle_rad = angle * M_PI / 180;
float sin_result = sin(angle_rad);
Serial.print("sin(");
Serial.print(angle);
Serial.print("°) = ");
Serial.println(sin_result);
}
}
void loop() {
}
The result in Serial Monitor:
COM6
sin(0°) = 0.00
sin(15°) = 0.26
sin(30°) = 0.50
sin(45°) = 0.71
sin(60°) = 0.87
sin(75°) = 0.97
sin(90°) = 1.00
sin(105°) = 0.97
sin(120°) = 0.87
sin(135°) = 0.71
sin(150°) = 0.50
sin(165°) = 0.26
sin(180°) = -0.00
Autoscroll
Clear output
9600 baud
Newline
※ ARDUINO BUY RECOMMENDATION
Arduino UNO R3 | |
Arduino Starter Kit |
Please note: These are Amazon affiliate links. If you buy the components through these links, We will get a commission at no extra cost to you. We appreciate it.