Advertisement
Guest User

Untitled

a guest
Jul 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1.  
  2. int beep=13;
  3. void setup()
  4. {
  5.   Serial.begin(9600);
  6.   pinMode(beep, OUTPUT);
  7. }
  8.  
  9. void Beep();
  10. void SerialPrint();
  11.  
  12. //**************************************
  13. void loop()
  14. {
  15.   int n=10000;
  16.   for (int i=10; i<n; i+=10)
  17.   {
  18.     for(int j=0;j<(n-i)/10;j++)
  19.     {
  20.     Beep(i);
  21.     //SerialPrint(n,i,j);
  22.     }
  23.   }
  24. }
  25. //*************************************
  26.  
  27. void Beep(int P)
  28. {
  29.   digitalWrite(beep, HIGH);   // turn the LED on (HIGH is the voltage level)
  30.   delayMicroseconds(P);
  31.   //delay(P);                       // wait for a second
  32.   digitalWrite(beep, LOW);    // turn the LED off by
  33.   //delay(P);                       // wait for a second
  34.   delayMicroseconds(P);
  35. }
  36.  
  37. void SerialPrint(int N, int I, int J)
  38. {
  39.     Serial.print (N);
  40.     Serial.print ("_");
  41.     Serial.print (I);
  42.     Serial.print ("_");
  43.     Serial.println (J);
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement