Advertisement
Guest User

Teetimer Arduino Code

a guest
Jun 25th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. #include <Servo.h>
  2.  
  3. Servo servo_pin_11;
  4. int zeit = 0 ;
  5. int wiederhole = 0 ;
  6. int fertig = 0 ;
  7. int a;
  8.  
  9. void setup()
  10. {
  11. servo_pin_11.attach(11);
  12. Serial.begin(9600);
  13. pinMode( 10 , OUTPUT);
  14. pinMode( 6 , OUTPUT);
  15. servo_pin_11.write( 35 );
  16.  
  17. zeit = 0 ;
  18.  
  19. wiederhole = 5 ;
  20.  
  21. fertig = 40 ;
  22.  
  23. }
  24.  
  25. void loop()
  26. {
  27. Serial.print("programm start");
  28. Serial.println();
  29. servo_pin_11.attach(11);
  30. digitalWrite( 10 , HIGH );
  31. digitalWrite( 6 , LOW );
  32. delay( 1000 );
  33. servo_pin_11.write( 35 );
  34. delay( 1000 );
  35. servo_pin_11.detach();
  36. Serial.print("poti auslesen");
  37. Serial.println();
  38. zeit = map ( analogRead(4) , 0 , 1023 , 0 , 30000 ) ;
  39. for (a=1; a<= ( wiederhole ); ++a )
  40. {
  41. Serial.print("1 nach");
  42. Serial.print(zeit);
  43. Serial.println();
  44. delay( zeit );
  45. }
  46. servo_pin_11.attach(11);
  47. delay( 100 );
  48. for (a=1; a<= ( 3 ); ++a )
  49. {
  50. Serial.print("ruetteln eins");
  51. Serial.println();
  52. servo_pin_11.write( 40 );
  53. delay( 300 );
  54. servo_pin_11.write( 30 );
  55. delay( 300 );
  56. }
  57. servo_pin_11.detach();
  58. for (a=1; a<= ( wiederhole ); ++a )
  59. {
  60. Serial.print("2 nach");
  61. Serial.print(zeit);
  62. Serial.println();
  63. delay( zeit );
  64. }
  65. servo_pin_11.attach(11);
  66. delay( 100 );
  67. for (a=1; a<= ( 3 ); ++a )
  68. {
  69. Serial.print("rueteln zwei");
  70. Serial.println();
  71. servo_pin_11.write( 40 );
  72. delay( 300 );
  73. servo_pin_11.write( 30 );
  74. delay( 300 );
  75. }
  76. servo_pin_11.detach();
  77. for (a=1; a<= ( wiederhole ); ++a )
  78. {
  79. Serial.print("3 nach");
  80. Serial.print(zeit);
  81. Serial.println();
  82. delay( zeit );
  83. }
  84. servo_pin_11.attach(11);
  85. delay( 100 );
  86. for (a=1; a<= ( 3 ); ++a )
  87. {
  88. Serial.print("rueteln drei");
  89. Serial.println();
  90. servo_pin_11.write( 40 );
  91. delay( 300 );
  92. servo_pin_11.write( 30 );
  93. delay( 300 );
  94. }
  95. servo_pin_11.detach();
  96. for (a=1; a<= ( wiederhole ); ++a )
  97. {
  98. Serial.print("4 nach");
  99. Serial.print(zeit);
  100. Serial.println();
  101. delay( zeit );
  102. }
  103. servo_pin_11.attach(11);
  104. delay( 100 );
  105. Serial.print("Servo Endposition");
  106. Serial.println();
  107. for (a=1; a<= ( 44 ); ++a )
  108. {
  109. fertig = ( fertig + 1 ) ;
  110. servo_pin_11.write( fertig );
  111. delay( 30 );
  112. }
  113. servo_pin_11.write( 85 );
  114. delay( 1000 );
  115. Serial.print("summer start");
  116. Serial.println();
  117. servo_pin_11.detach();
  118. digitalWrite( 6 , HIGH );
  119. delay( 2000 );
  120. digitalWrite( 6 , LOW );
  121. delay( 3000 );
  122. Serial.print("blink start");
  123. Serial.println();
  124. for (a=1; a<= ( 500 ); ++a )
  125. {
  126. Serial.print("blinken 500");
  127. Serial.println();
  128. digitalWrite( 10 , LOW );
  129. delay( 2000 );
  130. digitalWrite( 10 , HIGH );
  131. delay( 300 );
  132. }
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement