belrey10

The Best Way to View Your HERO’s Data

Nov 4th, 2024 (edited)
11
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * This code was Created by Jonathan Pereira on 10th February 2016 and is in the public domain.
  3.  * Comment the type of wave that you do not wish to generate.
  4. */
  5. void setup() {
  6.   // put your setup code here, to run once:
  7. Serial.begin(9600);
  8. }
  9.  
  10. void loop()
  11. {
  12.   //Sine Wave & Cosine Wave
  13.   float angle=0;
  14.   for(angle=0;angle<=90;angle=angle+0.1)
  15.   {
  16.     float sina=sin(angle);
  17.     float cosa=cos(angle);
  18.     Serial.print(sina);
  19.     Serial.print(" ");
  20.     Serial.println(cosa);
  21.     delay(1);
  22.   }
  23.  
  24.   //Sawtooth Wave
  25.   for(float i=0; i<=90; i=i+1)
  26.   {
  27.     Serial.println(i);
  28.     delay(1);
  29.   }
  30.  
  31.  
  32.  
  33.   //Square Wave
  34.   for(int a=0; a<=100; a++)
  35.   {
  36.     int b=0;
  37.     Serial.println(b);
  38.     delay(1);  
  39.   }
  40.   for(int a=0; a<=100; a++)
  41.   {
  42.     int b=100;
  43.     Serial.println(b);
  44.     delay(1);  
  45.   }
  46.  
  47.  
  48.   //Triangular wave
  49.   for(float i=0;i<=100;i=i+1)
  50.   {
  51.     Serial.println(i);
  52.     delay(1);
  53.   }
  54.   for(float i=100;i>=0;i=i-1)
  55.   {
  56.     Serial.println(i);
  57.     delay(1);  
  58.   }
  59.  
  60. }
  61.  
Tags: cogsworth
Add Comment
Please, Sign In to add comment